Why does my JSON fail to parse? Common syntax errors and how to fix them fast
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.
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.
By TechCompare · Updated
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
The big three are concrete and fixable: trailing commas after the last array or object item (legal in JS, illegal in JSON), single quotes instead of double quotes on strings or keys (legal in JS and Python, illegal in JSON), and unquoted property keys (legal in JS object literals, illegal in strict JSON). A formatter catches all three at the exact character position the parser choked on, where the raw JSON.parse error typically reports only an opaque 'Unexpected token at position 847' that doesn't tell you which of the three you hit. VS Code's built-in JSON language mode adds the red-squiggly pass earlier, before you ever invoke parse, which is the cheaper way to catch the same mistakes. The human-only failure mode is hand-writing JSON in a JS/TS codebase and inheriting the trailing-comma habit, which a formatter surfaces the moment you paste the file in.
More JSON scenarios
Related guides
Frequently asked questions
Why does JSON not allow trailing commas?
What's the most common JSON parse error?
Why are single quotes invalid in JSON?
Related tools
Unix Timestamp
Convert between Unix timestamps and human-readable dates.
Use tool ➜CHMOD Configurator
Calculate Linux file permissions using checkboxes, octal numbers, or symbolic notation.
Use tool ➜Text Encoding Converter
Convert between Text, Base64, Binary, Hexadecimal, and Decimal formats.
Use tool ➜