The five bugs you will hit, and how to fix them fast
1. Trailing comma
The single most common JSON parse error. {"a": 1,} dies with 'expected property name, got }'. Fix: remove the trailing comma. Prevention: format on save with a tool that knows JSON's rules.
2. Single quotes
Pasted from JS / Python source: {'name': 'Pippa'}. The fix is mechanical: sed "s/'/\"/g", or paste through JSON.stringify(eval(...)) in a sandbox, or just retype.
3. Comments
// comment or /* ... */ in JSON dies. The fix: strip them, or switch to JSONC (VS Code config) / JSON5 (with explicit parser opt-in). Don't fight the spec.
4. Unescaped special characters in strings
Raw newlines, raw tabs, lone backslashes inside strings. Use \n, \t, \\. The error usually points one line later than the actual mistake.
5. Encoding mismatch
UTF-8 with a BOM (byte order mark) at the start trips strict parsers. Many editors add the BOM silently on Windows. Fix: save as 'UTF-8 without BOM'. The error message is usually 'unexpected token at position 0'.
jq . file.json. jq tells you the line and column of the syntax error in a way most language stdlibs don't. For deeply nested issues, jq -e exits non-zero on parse failure — useful in CI.