JSON Repair — Fix LLM-Mangled JSON
Paste broken JSON (or paste an LLM response that contains JSON mixed with prose — the tool extracts the JSON block). The right panel shows the repaired output and a change log lists every fix applied. Best-effort: for truly mangled output (truncated mid-token, mixed encodings), some recoveries fail.
Change log
How to repair JSON
- Paste broken JSON (or paste an LLM response that contains JSON mixed with prose — the tool extracts the JSON block).
- The right panel shows the repaired output. A change log below lists every fix applied ("removed trailing comma on line 12", "wrapped unquoted key
namein quotes"). - If the repair confidence is low, the banner says Best-effort repair — review before using.
- Copy the result, or Format to jump straight to json-formatter with the cleaned output.
What it fixes
- Trailing commas after the last item in arrays / objects.
- Single quotes around strings and keys → double quotes.
- Unquoted keys (
{name: 1}) → quoted keys. - Smart quotes (curly
“ ”from word processors) → straight quotes. - JS-style comments (
//and/* */) — stripped. - BOM (byte order mark) at the start of a file — stripped.
- Prose around JSON ("here's the JSON:
{...}") — the JSON block is extracted.
FAQ
Why is this a "best effort"?
Some breakage is unrecoverable — for example, a truncated string with a missing closing quote, or a number formatted as "1,234" where the comma is the thousands separator. The change log shows what was fixed; if the result still doesn't parse, you'll need to fix the rest manually.
Will it handle JSON5?
Mostly — JSON5 (comments, trailing commas, unquoted keys, single quotes) is a superset of what this tool fixes. Hex numbers and explicit + signs aren't supported.
Why did my LLM output extract incorrectly?
If your LLM put multiple JSON snippets in one response (e.g. two code fences), the tool grabs the first object/array span only. Split the response by hand before pasting.
Will it work offline?
Yes — after the page loads. The repair runs locally on your browser.