We've all seen it: an API response that looks perfectly fine, but JSON.parse() throws a cryptic error at position 0. Or position 472. Or somewhere deep inside a 10,000-line config file. Here are the most common JSON syntax issues and how to diagnose them fast.
1. Trailing Commas (The #1 Offender)
{"name":"App","version":"2.0.1","dependencies":["react","lodash",],}
JSON spec (RFC 8259) does not allow trailing commas. JavaScript and TypeScript are forgiving, so your IDE doesn't complain — but strict JSON parsers will fail. The fix: remove the comma after the last array item and last object key.
2. Smart Quotes vs. Straight Quotes
If you copy JSON from a word processor or a ChatGPT output, you might get "smart quotes" (curly) instead of straight quotes. They look similar but are different Unicode characters:
//ThisWILLfail—smartquotesonthekey{“name”:“hello”}//Thisiscorrect{"name":"hello"}
3. Unquoted Keys
JavaScript objects let you use unquoted keys. JSON does not:
//ValidJSobject,INVALIDJSON{name:"Alice",age:30}//CorrectJSON{"name":"Alice","age":30}
4. The Invisible BOM
If your JSON file starts with a UTF-8 BOM (Byte Order Mark), many parsers fail at position 0 — even though the file looks empty of problems. cat file.json | xxd | head -1 and look for EF BB BF at the start.
5. Single Quotes
JavaScript accepts both single and double quotes for strings. JSON does not:
//Invalid{'key':'value'}//Valid{"key":"value"}
Debugging Tip
When you encounter a parse error, don't just stare at the JSON. Use a formatter that shows the exact line and column of the first syntax error.
I built a free JSON formatter and validator for exactly this purpose — paste your JSON, click Validate, and it tells you exactly where the error is. All processing happens in your browser, no data leaves your machine.
The most useful feature: it works offline once the page loads. I've used it on flights to debug local config files without internet.
Got a favorite JSON debugging technique? Drop it in the comments.