JSON Repair
Fix the small things that make a JSON document fail: a code fence, a trailing comma, a Python boolean, single quotes, a comment, or a cut-off tail. You see every change, and the result must pass a strict parse before it is shown.
Runs entirely in your browser — your JSON is never uploaded.
Everything runs in this browser tab. Nothing is uploaded.
A worked example
Repair only applies mechanical rewrites. Every change is reported, so you can see what the tool decided.
Input
```json
{
name: "Ada",
active: True,
}
```Output
{
"name": "Ada",
"active": true
}
Changes:
- removed markdown fence
- quoted bare key: name
- quoted bare key: active
- True -> true
- removed trailing commaA strict JSON.parse must accept the result before the repaired document is shown.
How to repair a document
- Paste the broken text, including any code fence or chatty text around it. The tool extracts the document first.
- Press Repair JSON. Each rewrite is recorded below the button.
- Copy the repaired text, or press Use as input to run another pass — for example to validate it afterwards.
If the pasted text is already valid, nothing is rewritten. A repair that cannot reach a strict parse is never shown as a result, so you will not be handed text that still fails downstream.
What it fixes, and what it does not
| You pasted | Repair applied | Why it matters |
|---|---|---|
| ```json … ``` around the output | Fence removed | Common when copying an answer from a chat assistant. |
| Text before or after the document | Surrounding prose removed | Only text outside the outermost braces or brackets is removed. |
| // comment or /* comment */ | Comment stripped | JSON has no comment syntax; JSONC does. |
| 'name': 'Ada' | Quotes normalised to double | Internal double quotes are escaped, not dropped. |
| {name: 'Ada'} | Property name quoted | Bare identifiers used as keys are wrapped in double quotes. |
| True, False, None | Mapped to true, false, null | Python and JavaScript spellings of the same three values. |
| NaN, Infinity, -Infinity | Replaced with null | JSON has no representation for these numbers. |
| [1, 2,] or {"a": 1,} | Trailing comma removed | A comma may separate members but not follow the last one. |
| Curly quotes “ ” ‘ ’ | Normalised to straight quotes | Straight quotes are what the JSON grammar requires. |
| Document stops mid-object or mid-string | Open delimiters closed | Only the delimiters that are actually open are added. |
Why assistant output breaks
A language model writes JSON the way it writes prose: with a fence around it, a sentence before it, and the occasional Python value borrowed from a code sample. None of those are valid under RFC 8259, but all of them are easy to reverse mechanically.
The difficult case is truncation. When a response hits its token limit mid-object, the text stops where the model stopped. Closing the open braces makes the text parseable, but it cannot restore the fields that were never generated. Treat a repaired truncation as a partial document, not as the complete answer.
For the reasoning behind the individual messages a strict parser produces, read JSON parse errors, decoded. If the file came from a config editor rather than a model, the failure is usually a comment or a trailing comma — the subject of why JSON5 fails.
Where to be careful
- Duplicate keys. If the same name appears twice in one object, repair keeps both in the text. A later parser will usually keep only the last value, so check the document if duplicates matter to you.
- Numbers like 0xFF or .5. JSON forbids them and this tool does not rewrite them into decimal, because guessing the intended number would change your data.
- Valid but wrong. Repair only addresses syntax. A document that parses can still have the wrong types, missing fields or stale values.
- Large integers. Repair never parses your text into a JavaScript number, so
9007199254740993keeps its last digit. Formatting the result afterwards does the opposite — see why JSON numbers lose precision.