7 Common JSON Errors and How to Fix Them (with Examples)
Missing commas, trailing commas, unquoted keys, bracket mismatches and more — each common JSON error explained with a broken and fixed example.
Almost every "Invalid JSON" message comes from one of seven mistakes. Learn them once and you will fix most payloads in under a minute.
1. Missing comma
{"a": 1 "b": 2}
Fix: {"a": 1, "b": 2}. Two values in an object or array must be separated by a comma.
2. Trailing comma
{"a": 1,}
Fix: remove the last comma. Strict JSON forbids it (JSON5 allows it — see JSON vs JSON5).
3. Missing or single quotes
{name: 'Ada'}
Fix: {"name": "Ada"}. Keys and strings need double quotes.
4. Unmatched braces or brackets
{"items": [1, 2}
Fix: close in reverse order — {"items": [1, 2]}. Formatting with the JSON formatter makes these obvious.
5. Invalid values
{"active": undefined}
Only strings, numbers, booleans, null, objects and arrays are allowed. Use null, not undefined or functions.
6. Malformed strings
{"bio": "line one
line two"}
Fix: escape the newline — {"bio": "line one\nline two"}. The JSON escape tool does this for you.
7. Extra text after the document
{"a": 1} {"b": 2}
One JSON document per parse. Wrap multiples in an array or use JSON Lines tooling.
Fastest fix workflow
- Paste into the JSON validator and press Go to error.
- Fix the character at that line and column.
- Press Format in the JSON formatter to confirm.