True/False/None, and truncated data. Paste it into the JSON Repair tool and it fixes them automatically and shows you a diff of every change.You ran JSON.parse() and got SyntaxError: Unexpected token. Frustrating — but the cause is almost always one of a handful of common mistakes. Here is each one, why it breaks, and how to fix it (by hand or in one click).
First: find out what's actually wrong
Before fixing, see the error. A JSON validator shows the exact line and column of the first problem. Then come back here to fix it — or skip straight to the repair tool, which does both: diagnoses and fixes.
The common causes of broken JSON — and the fix
1. Trailing commas
{ "a": 1, "b": 2, } // remove the last commaLegal in JavaScript, illegal in JSON. Fix: delete the comma before the closing } or ].
2. Single quotes
{ 'name': 'Ada' } -> { "name": "Ada" }JSON only allows double quotes. Fix: replace every ' with " (watch for apostrophes inside values, which must be escaped or left alone).
3. Unquoted keys
{ name: "Ada" } -> { "name": "Ada" }JavaScript object syntax, not JSON. Fix: wrap every key in double quotes.
4. Comments
{
"port": 8080 // not allowed in JSON
}Standard JSON has no comments. Fix: remove // and /* */ blocks.
5. Python dicts (True / False / None)
{ 'active': True, 'role': None }
->
{ "active": true, "role": null }Pasting a Python dict or a print() dump is one of the most common causes of "invalid JSON." Python uses True, False, None and single quotes. Fix: convert them to true, false, null and double quotes. The repair tool does this conversion automatically — it's effectively a Python-dict-to-JSON converter.
6. Truncated / cut-off JSON
{ "items": [1, 2, 3 // stream cut off — brackets unclosedCommon with log files, byte-limited API responses, or clipboard truncation. Fix: close the open brackets/braces in the right order. The repair tool detects unclosed structures and appends the minimum tokens to make it valid (then tells you it did).
7. Wrong value types
{ "count": 01, "note": undefined } // invalidNo leading zeros; undefined and NaN don't exist in JSON. Fix: use plain numbers and null.
Fix it automatically in 3 steps
- Open the JSON Repair tool and paste your broken JSON (or drag in a
.jsonfile). - It repairs the JSON instantly and lists every change — switch to the side-by-side diff to see exactly what changed.
- Copy the result, Download it as a
.jsonfile, or click Apply fix to replace the input. Everything runs locally — nothing is uploaded.
When the data is truly incomplete (a truncated stream), no tool can invent the missing values — the repair tool will close the structure and flag that some data may still be missing so you can finish it by hand.
Then validate and format
- Repair to fix the syntax.
- Validate to confirm it's clean — see How to Validate JSON.
- Format to pretty-print it — see What Is JSON Formatting?
Frequently asked questions
Can a repair tool fix any broken JSON? It fixes syntax mistakes (commas, quotes, keys, comments, Python literals, unclosed brackets). It can't recover data that was never there — truncated content has to be completed manually.
Is it safe to paste sensitive JSON? Yes — repair runs entirely in your browser; nothing is sent to a server.
Does fixing change my data? No. It only corrects syntax so a parser will accept it; your values are preserved.
Wrapping up
Broken JSON is almost always one of these seven patterns — and a repair tool that shows you a diff of every change turns a tedious hunt into a single click.
Fix your JSON for free →Related free tools: JSON Validator · JSON Formatter · All JSON Tools