You paste JSON into your application and get SyntaxError: Unexpected token. The error message points to a character position deep inside a 500-line config file. You stare at the JSON and everything looks fine. This guide covers the most common causes of broken JSON and how to find and fix them in seconds.
1. Trailing Commas
The single most common JSON error. JSON does not allow a comma after the last item in an object or array. This is valid in JavaScript but invalid in JSON.
2. Single Quotes Instead of Double Quotes
JSON requires double quotes for both keys and string values. Single quotes, backticks, and unquoted keys are all invalid in strict JSON.
3. Comments in JSON
Standard JSON does not support comments — not // single-line nor /* */ block comments. If you need comments, use JSONC (supported by VS Code and TypeScript) or JSON5.
4. Unescaped Special Characters
Inside JSON strings, backslashes and double quotes must be escaped. Newlines and tabs must use escape sequences. Raw control characters will break parsing.
5. Missing Commas Between Properties
Every property-value pair in an object must be separated by a comma, except the last one. Missing a comma produces an unhelpful error pointing to the next property.
6. Invalid Value Types
JSON only supports: strings, numbers, booleans (true/false), null, objects, and arrays. JavaScript-specific values like undefined, NaN, Infinity, and Date objects are not valid JSON.
7. Invisible BOM Characters
Some text editors prepend an invisible BOM (Byte Order Mark) character at the start of files. This is invisible in most editors but causes parsing errors at position 0. Save files as UTF-8 without BOM.
How to Find Errors Quickly
Our JSON Formatter and Validator pinpoints the exact line and character position of JSON syntax errors. Paste your JSON, and it will highlight exactly what is wrong and where — much more useful than a generic error message.