Black Friday · 50% off Pro AnnualEnds Dec 1

How to Export One ChatGPT Conversation to JSON

By Stashkin ·

To save one ChatGPT conversation as JSON, open the saved chat in Chrome, open Stashkin and choose JSON. Choose the whole conversation or assistant replies only. For a single answer, use the export menu beside that answer.

Use JSON when you want to read the conversation in a script, build a local search index or compare answers. For a document you can edit in Word, choose DOCX instead.

In this article

Download the conversation you need

  1. Open a saved ChatGPT conversation

    Install Stashkin from the Chrome Web Store, then refresh the ChatGPT tab. Open the conversation you want to keep and wait for the answer to finish.

  2. Choose which messages to include

    Open Stashkin from Chrome’s Extensions menu. Choose the whole conversation to keep prompts and answers, or assistant replies only to omit your prompts. Use Select messages when you need a smaller set.

  3. Choose JSON and check the download

    Click JSON, open the downloaded .json file in a text editor and check the title and message count. To export one answer, open its Stashkin export menu beside ChatGPT’s Copy control and choose JSON.

Read the JSON structure

Stashkin writes a title and a turns array. Each turn has a role, a display label, plain text and Markdown. When the source-link setting is on, the file also includes the conversation URL in source.

Read text for plain-text processing. Read markdown when you need headings, code fences or table syntax. An image reference inside Markdown is a reference to an image, rather than a separate file attachment.

JSON

{
  "title": "Weekend reading",
  "turns": [
    {
      "role": "user",
      "label": "You",
      "text": "Suggest one book about trees.",
      "markdown": "Suggest one book about trees."
    },
    {
      "role": "assistant",
      "label": "ChatGPT",
      "text": "Try The Hidden Life of Trees by Peter Wohlleben.",
      "markdown": "Try **The Hidden Life of Trees** by Peter Wohlleben."
    }
  ]
}

Read the sample with Python

Download the JSON sample below into the same folder as this script. The sample contains a fictional conversation. Run the script with Python 3 to print the assistant’s answer.

Python

import json
from pathlib import Path

chat = json.loads(Path("chatgpt-json-sample.json").read_text(encoding="utf-8"))
for turn in chat["turns"]:
    if turn["role"] == "assistant":
        print(turn["text"])

Check scope before using the file

Stashkin exports the selected messages from the open conversation. It does not export every chat in your account, deleted conversations, other branches of a conversation or account settings.

The Stashkin JSON schema differs from OpenAI’s account archive. Check the fields before passing it to a tool that expects conversations.json. JSON export does not create a ChatGPT import file or guarantee that another service can restore the chat.

Review the prompts, answers and optional source URL before sharing the file. Stashkin generates JSON in your browser; any application you upload it to has its own data handling rules.

Inspect the sample

This file was generated with Stashkin’s JSON serializer from the fictional conversation shown above. It contains two turns and no private conversation URL.

Export the open conversation with Stashkin

Choose one answer, selected messages, assistant replies only or the whole conversation. Export to Word, PDF, Markdown, TXT, PNG or JSON.