How to fix broken or invalid JSON online

Yellorn's Data Doctor auto-repairs the most common ways JSON breaks, then tells you exactly what it changed — so nothing is reshaped behind your back.

Yellorn first tries to parse your text as strict JSON. If that fails, the Data Doctor runs a best-effort repair pass — fixing the common ways JSON gets mangled by a copy-paste, an LLM, or a log dump — and shows you the result in the tree, graph, and table views.

There is nothing to click for the basics: just paste, and the editor parses what it can. To rewrite the text itself into clean JSON, use the Format menu (covered below).

Yellorn editor showing pasted Python-ish JSON — single quotes, a trailing comma, a // comment, and Python's True/None — already parsed in the tree on the right, with the status bar reading 'Auto-fixed: remove-comments, python-literals, trailing-commas, single-quotes, unquoted-keys'
Paste messy, Python-ish JSON and it's already valid — the status bar lists every fix the Data Doctor applied automatically.
Same document after clicking Smart Format — clean, double-quoted, multi-line JSON with a 'Valid JSON' status
Click Smart Format to rewrite the buffer itself into clean, pretty-printed JSON.

The most common fixes, all applied automatically:

  • Markdown fences — strips a wrapping ```json … ``` block.
  • Comments — removes // line, /* … */ block, and Python # comments.
  • Trailing commas and missing commas between items.
  • Single quotes → double quotes, and unquoted keys get quoted.
  • Python literals None/True/False become null/true/false; tuples and set([…]) become arrays; Decimal(…) and datetimes become values.
  • Unbalanced brackets — auto-closes a missing } or ].

Smart Format goes further: it can unwrap JSON that was stored as a string and recover two or more JSON documents glued together by bad escapes — turning the kind of mess you copy out of a log into a single clean object.

When a repair runs, the status bar reads “Auto-fixed: …” and lists what changed. You always see the transformation — Yellorn never reshapes your data behind your back. If even the best-effort pass can't parse the text, the error points at the line so you can fix it by hand.

  • Smart Format — full recovery: runs the repair ladder, then pretty-prints with 2-space indent. The one to reach for on broken input.
  • Simple Format — pretty-print that preserves value types without the aggressive repairs.
  • Safe Format — re-indents layout only, changing nothing about the data.
  • Compress — minifies to a single line.

Each is one entry on the undo stack, so a single Ctrl/Cmd+Z restores the text you started with.

Is it safe to fix JSON online?

Yes. Yellorn parses and repairs JSON entirely in your browser — the text you paste is never uploaded to a server. That makes it safe to fix JSON that contains API responses, tokens, or customer data.

What JSON errors does Yellorn fix automatically?

The Data Doctor strips markdown ```json fences, removes // and /* */ comments, converts single quotes to double quotes, quotes unquoted keys, drops trailing commas, inserts missing commas, normalises Python None/True/False, and auto-closes unbalanced or truncated brackets — among other common paste errors.

Will it change my data without telling me?

No. Every repair is reported in the status bar as 'Auto-fixed: …' listing exactly which passes ran, so you consent to each transformation. Yellorn never silently reshapes your data; if even best-effort repair fails, it points you at the failing line.

Can it fix JSON returned by ChatGPT or other LLMs?

Yes. Paste the model's reply, fences and prose included, and Yellorn extracts and repairs the JSON inside. See the dedicated guide on fixing broken JSON from ChatGPT and other LLMs for the LLM-specific failure modes.

Does it work on large JSON files?

Yes. Parsing runs in a background worker so the editor stays responsive, and the tree, graph, and table views are virtualized. Very large inputs are capped with a clear notice so the tab never freezes.

Try a fix in the editor or browse more articles.