Why does my JSON fail to parse? Common syntax errors and how to fix them fast

JSON parse errors are frustrating because the error messages are usually unhelpful ("Unexpected token at position 847"). The three most common mistakes are trailing commas after the last item in an array or object, using single quotes instead of double quotes for strings, and using unquoted property keys.

Topic
JSON parse errors
json-errors
Category
Troubleshooting
JSON knowledge base

Calculator

Back to Home

JSON Formatter

Validate, format, and minify JSON data.

How this is calculated

Trailing commas are the number-one culprit. JavaScript allows them; JSON does not. Developers who write JSON by hand in a JS/TS codebase naturally add trailing commas, then wonder why JSON.parse throws. Single quotes are a close second: JSON spec requires double quotes for all strings and keys, but JavaScript and Python both accept single-quoted strings, so the habit leaks. Unquoted keys (e.g., {name: "Alice"} instead of {"name": "Alice"}) work fine in JavaScript object literals but fail in strict JSON.

Verdict

Use a JSON formatter to catch syntax errors instantly. The tool highlights the exact position of the error and shows you what the parser expected vs what it found. For VS Code users, the built-in JSON language mode catches most errors with red squigglies before you even try to parse.

Frequently asked questions

Why does JSON not allow trailing commas?
Douglas Crockford, JSON's creator, intentionally kept the spec minimal and strict. Trailing commas cause ambiguity in some parsers and were omitted to keep JSON a true subset of JavaScript's object literal syntax at the time.