JSON Repair

Paste JSON that will not parse. It gets explained, then fixed, with a diff.

Broken input
Repaired output

About this tool

A JSON repair engine takes a document that will not parse and produces the closest valid JSON, then shows you exactly what it changed. It handles more than thirty known breakage patterns: trailing commas, single quotes, unquoted keys, comments, Python True/False/None, missing brackets, and truncated files.

A growing share of broken JSON arrives from chat models: a response wrapped in a ```json fence, prefixed with "Here's your JSON:", or with commentary glued after the closing brace. Clean up AI output — on by default — strips that envelope before repairing what is left.

When something cannot be fixed without guessing at your intent, the tool says precisely what is still wrong instead of inventing a result. Nothing is ever rewritten silently.

How to use it

  1. Paste the broken JSON — or the entire chat reply, fence and all.
  2. Read the findings: each one names what is wrong and where, in plain English.
  3. Press Fix it. The repaired document replaces your input, and the report lists every change, grouped and counted — never a silent rewrite.

Worked example

This reply has a fence, a prose prefix, single quotes and a trailing comma. Cleanup strips the envelope; repair fixes the syntax; the report lists each change.

Sure! Here's your config:

```json
{
  'port': 8080,
  'host': 'localhost',
}
```

Let me know if you need changes!

One document, four problems

Frequently asked questions

What can be fixed automatically?
Trailing commas, single or typographic quotes, unquoted keys, comments (JSONC/JSON5), Python's True/False/None, undefined, missing brackets and quotes, truncated documents, hex and leading-plus numbers, NaN and Infinity, and AI-reply envelopes: code fences, prose before and after, byte-order marks and non-breaking spaces.
Can it fix JSON from ChatGPT or Claude?
Yes — that is the most common input here. Model replies wrap JSON in a markdown fence and often add prose around it; the cleanup pass unwraps the fence and removes the prose, then the repair engine handles the syntax problems inside. Even a reply that hit the output limit mid-document is closed up and reported as truncated-then-repaired.
What can it NOT fix?
Anything where the fix would be a guess: a value that is missing entirely (was it a string? a number?), two documents where one was meant, or a key whose name is ambiguous. In those cases the tool reports exactly what is unresolved rather than inventing data — silent fabrication is worse than a clear failure.
Does repair change my data?
Only syntax. Keys, values, key order and exact number digits are preserved; the report before the output pane lists every class of change with a count. If the output looks wrong, the diff tells you which edit to undo.
Is there a limit on input size?
No fixed one. Repair runs in a background thread in your browser, so a large file repairs without freezing the tab; the limit is your device's memory.