5 JSON Syntax Errors That Break Your Code (And How to Fix Each One)

June 26, 2026 · 5 min read

After debugging JSON parse errors for over a decade, I can tell you the same five mistakes show up 90% of the time. Here they are, with the exact fix for each.

1. Trailing Commas

JSON does not allow a comma after the last item in an object or array. JavaScript objects do, which is why this trips people up constantly.

Wrong: {"name": "John", "age": 30,}
Right: {"name": "John", "age": 30}

2. Single Quotes Instead of Double

JSON strings must use double quotes. Single quotes are valid in JavaScript and Python but not in JSON. This is the second most common error.

Wrong: {name: "John"}
Right: {"name": "John"}

3. Unquoted Keys

All object keys in JSON must be double-quoted strings. JavaScript lets you skip quotes on keys; JSON does not.

4. Comments in Data Files

JSON spec does not support comments. If you need documentation, use JSONC (VS Code variant) or add a separate documentation field like _comment.

5. Unescaped Backslashes

Backslashes must be escaped in JSON strings. Windows file paths are the most common culprit: C:\Users\name should be C:\\Users\\name.

The fastest way to find these errors: paste your JSON into Formly JSON formatter and click Validate. It tells you the exact line and position of the first error.

Sam TaylorWritten by Sam Taylor — Full-Stack Developer. More about me →