Skip to content
Developer Tips8 min read

10 common JSON errors and how to fix them

Every JSON syntax error you'll ever see — trailing commas, unquoted keys, bad escapes — with a working repair strategy.

By JSON Formatter Team

1. Trailing commas

JSON forbids a comma after the last item in an object or array. {"a":1,} is invalid — remove the comma.

2. Single quotes

Keys and strings must use double quotes. {'a':1} is not JSON. Convert every ' around a key or value into ".

3. Unquoted keys

{a:1} is JavaScript, not JSON. Every key must be a double-quoted string.

4. Comments

Standard JSON has no comments. Use JSONC only where the consumer expects it (VS Code settings, tsconfig). Strip // and / / before shipping.

5. Unescaped characters in strings

Newlines, tabs and backslashes inside a string must be escaped: \n, \t, \\.

6. Wrong booleans / null

Only lowercase true, false and null are valid. True, None, nil are not.

7. Leading zeros on numbers

007 is invalid. Use 7 or a string.

8. Duplicate keys

Technically valid but universally discouraged — most parsers silently keep only the last value.

9. Encoding issues

Save JSON as UTF-8 without a BOM. The BOM (\uFEFF) trips many parsers.

10. Mismatched brackets

The classic. Use the JSON Formatter — it points at the exact line and column of the first mismatch.

Auto-repair

Our formatter's Repair button applies safe fixes for the first six errors above automatically. Paste, click Repair, then Beautify.