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).

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.

Try a fix in the editor or browse more articles.