Common JSON syntax errors
JSON is strict. One stray comma triggers parse errors—here are the usual suspects.
Trailing commas
JavaScript object literals allow trailing commas; JSON does not. Remove the comma after the last property or array item.
Quotes
Keys and string values need double quotes. Single-quoted strings are invalid JSON.
Escaping
Backslashes and quotes inside strings must be escaped. Newlines in strings must be \n, not literal line breaks.
Numbers and booleans
No NaN or undefined—omit keys or use null. Leading zeros on numbers are invalid.
Checklist
- Validate in an editor with JSON schema when available.
- Remove trailing commas before pasting into production configs.
- Escape backslashes inside string values.
- Minify only after format succeeds.
Key takeaway
JSON rewards precision. Most production issues trace to commas, quotes, or unescaped characters—fix syntax first, then debate semantics.
Last updated 2026. Draftwell publishes guides for education only—not professional legal, medical, or financial advice.