Home › Guides › Fix JSON from ChatGPT (and other LLMs)

Fix JSON from ChatGPT (and other LLMs)

Direct answer: copy the whole message — envelope and all — into the tool below. It strips the markdown fence and the surrounding chat prose, converts the loose syntax LLMs imitate (single quotes, unquoted keys, trailing commas, True/None), and hands you valid JSON plus a list of every change. If the answer was cut off mid-stream instead, use Truncated Recovery — same site, stricter tool.

Paste the whole chat answer — envelope and all

Processed in your browser, so big pastes don't freeze the page. Nothing is uploaded — check your browser's network tab if you'd like to verify.

What the tool does to a chat answer, step by step

  1. Removes the envelope: markdown code fences and any prose before or after the document are stripped — and listed in the report, so you can see the envelope was the problem.
  2. Converts loose syntax: single-quoted strings become double-quoted; unquoted keys get quoted; True, False and None become true, false and null.
  3. Repairs punctuation: trailing commas removed; missing commas and colons added — each at its own location in the report.
  4. Closes what's open: if the copy ends early, unclosed strings and structures are closed for repair purposes. For a genuinely truncated response you plan to feed to a machine, prefer Truncated Recovery, which drops the incomplete tail instead of completing it.

A copy-paste trap worth knowing

Chat interfaces sometimes render smart quotes (“ ”) or hide characters in long outputs. If a paste still fails after repair, the report's honest-failure message will point at the first character the tool cannot accept — check that spot in the original for a character that merely looks like a quote or a bracket. And when the data matters, compare the repaired output's key values against the visible answer: repair fixes syntax, not a number that quietly changed halfway through.

Prompt patterns that reduce the mess

Frequently asked questions

Why won't JSON from ChatGPT paste into my parser?

Usually because what you copied is a chat message, not a bare document: it can include an introduction line, a markdown code fence, and closing remarks around the JSON — and inside, the JSON itself often uses single quotes, trailing commas, or Python-style literals it imitated. Strip the envelope, fix the syntax family, and it parses.

The response just stops in the middle. What now?

It hit the output limit. You can ask the AI to continue (risky: continuations often restart or renumber), regenerate with a shorter requested output, or recover the complete prefix of what you already have with Truncated Recovery — every complete record, nothing invented for the cut tail.

How do I get clean JSON from ChatGPT next time?

Ask for "only the JSON, no explanation, no code fence", keep the requested document small, and if you are using the API, use JSON mode / structured outputs with a schema. Then still validate on receipt — instructions reduce breakage; they do not eliminate it.