JSON error reference
Every common way JSON.parse fails, what the message actually points at, and the specific fix — with a broken and a working example you can open in the validator.
Two things make these errors harder to read than they should be. The first is that the reported position is where the parser gave up, not where the mistake is — a missing comma is usually reported a token or two later. The second is that the engines word the same failure completely differently, and V8 changed its own wording around Chrome 109: what used to be Unexpected token } in JSON at position 8 is now ...is not valid JSON with a snippet. Each page below lists the wordings you are likely to see so you can match yours.
- Unexpected token in JSON at position NThe parser reached a character that cannot legally appear where it appeared. The position is where the parser gave up, which is usually just after the real mistake — a comma, a quote or a brace a few characters earlier.
- Unexpected end of JSON inputThe document ended while the parser was still waiting for something — a closing brace, a closing quote, or in fact any content at all. Unlike most parse errors this one carries no useful position, because the problem is the absence of characters rather than a wrong one.
- Trailing comma in JSONA comma may only separate two values. A comma followed by `}` or `]` is a syntax error in JSON, even though the identical code is legal in a JavaScript object or array literal and has been since ES5.
- Single quotes in JSONJSON defines exactly one string delimiter: the double quote. Single quotes are not an alternative form, they are not valid anywhere, and that applies to property names as well as to values.
- Unquoted property names in JSONIn JSON an object member is a *string* followed by a colon. There is no bare-identifier form, so `{name: "Ada"}` is invalid however ordinary the key looks.
- NaN and Infinity in JSONThe JSON number grammar covers an optional minus sign, digits, an optional fraction and an optional exponent. `NaN`, `Infinity` and `-Infinity` match none of that, and JSON has no literal for them.
- Byte order mark (BOM) breaks JSON.parseA byte order mark is the character U+FEFF, written as the bytes `EF BB BF` in UTF-8. It renders as nothing at all, and RFC 8259 does not permit it at the start of a JSON document — so a file that looks flawless fails at position 0.
- Comments are not allowed in JSONJSON deliberately has no comments. They were removed from the format early on, on the grounds that people would use them to carry parsing directives — so `//` and `/* */` are both syntax errors.
- "undefined" is not valid JSONSomething converted the value `undefined` to the six-character string `"undefined"` and handed that to `JSON.parse`. JSON has no `undefined` literal — the absent value in JSON is `null`.
- Bad escaped character in JSON stringsInside a JSON string a backslash may be followed by only these: `"`, `\`, `/`, `b`, `f`, `n`, `r`, `t`, or `u` followed by exactly four hex digits. Anything else is a bad escape. Separately, the raw control characters U+0000 to U+001F may never appear literally in a string — they have to be escaped.
The fastest way to find any of them
Paste the document into the JSON validator. It converts the parser's character offset into a line and column, highlights the spot, and will repair the mistakes that can be repaired unambiguously. Nothing is uploaded — the parsing happens in your browser.