JSON error reference
Every common way JSON.parse fails, what the message is really pointing at, and the fix. Each page has a broken example and a working one you can open in the validator.
Two things make these errors harder to read than they need to be. First, the position in the message is where the parser gave up, not where you went wrong. A missing comma usually gets reported a token or two late. Second, every engine words the same failure differently, and V8 changed its own wording around Chrome 109. What used to read Unexpected token } in JSON at position 8 now reads ...is not valid JSON with a snippet. Each page below lists the wordings you are likely to see, so you can match yours.
JavaScript
- Unexpected token in JSON at position N
JSON.parsehit a character it cannot accept. - Unexpected end of JSON inputYour JSON stopped early.
- Trailing comma in JSONA comma separates two values.
- Single quotes in JSONJSON defines exactly one string delimiter: the double quote.
- Unquoted property names in JSONIn JSON a key is a string, so it needs double quotes, then a colon.
- NaN and Infinity in JSONThe JSON number grammar covers an optional minus sign, digits, an optional fraction and an optional exponent.
- Byte order mark (BOM) breaks JSON.parseA byte order mark is the character U+FEFF, written as the bytes
EF BB BFin UTF-8. - Comments are not allowed in JSONJSON deliberately has no comments.
- "undefined" is not valid JSONSomething converted the value
undefinedto the six-character string"undefined"and handed that toJSON.parse. - Bad escaped character in JSON stringsInside a JSON string a backslash may be followed by only these:
",\,/,b,f,n,r,t, orufollowed by exactly four hex digits. - Unexpected token '<', "<!DOCTYPE "... is not valid JSONYour code asked for JSON and got an HTML page instead.
- Unexpected non-whitespace character after JSON at position N
JSON.parsereads exactly one value. - Expected ',' or '}' after property value in JSON
JSON.parseread a value, and the next character was not a comma or a closing brace. - Bad control character in string literal in JSONA JSON string cannot hold a raw line break or tab.
Python
- Expecting value: line 1 column 1 (char 0)Python got to a spot where a value has to begin and found something that cannot begin one.
- Expecting property name enclosed in double quotesThe parser was at a spot where a key has to begin, just after a
{or just after a comma, and the next character was not a double quote. - Extra data: line 1 column N (char N)
json.loadsreads exactly one JSON value and then stops. - Expecting ',' delimiterThe parser finished one value and found the next one starting straight away, with no comma between them.
- Illegal trailing comma before end of objectThe document has a comma right before a closing
}or]. - Unterminated string starting at: line N column N (char N)Python opened a string and reached the end of the document before the string closed.
- Invalid control character at: line N column N (char N)A JSON string has a raw line break or tab inside it.
Java (Jackson, Gson and Spring)
- Unrecognized token: was expecting a valueJackson lists the seven things a JSON value can be, because it found something that was none of them: a bare run of letters.
- Unexpected character ('}' (code 125))Jackson gives you the character it found, its decimal code, and then what it wanted instead.
- HttpMessageNotReadableException: JSON parse errorSpring adds
JSON parse error:in front of the message Jackson threw, so the useful part is everything after the colon. - Cannot deserialize value of type X from Array valueThe JSON starts with
[, so it is a list, but you asked Jackson for one object. - Cannot construct instance of X (no Creators, like default constructor, exist)Jackson needs a way to create your class, and this one has no default constructor and no annotations on the one it has.
- Java 8 date/time type java.time.LocalDateTime not supported by defaultA plain Jackson 2
ObjectMapperdoes not know thejava.timetypes, so it fails on aLocalDateTime. - Unrecognized field "X" (class Y), not marked as ignorableThe JSON has a key,
carrier, that your class does not have, and a plain Jackson 2ObjectMapperfails on unknown keys. - Cannot deserialize value of type X from StringThe JSON has a string Jackson cannot turn into the Java type, here
14/10/2026going into ajava.util.Date. - No content to map due to end-of-inputJackson was given an empty string, so there was nothing to read.
- Expected BEGIN_OBJECT but was STRINGGson wanted a JSON object and found something else.
- MalformedJsonException: Unterminated objectGson stopped because the text is not valid JSON.
PHP
Go
C# (.NET)
Not sure what JSON is yet?
Start with what is a JSON file. It covers the format, its six types, and the three mistakes behind most of the errors above. If you just need to open one, how to open a JSON file covers every platform.
The fastest way to find any of them
Paste the document into the JSON validator. It turns the parser's character offset into a line and column, highlights the spot, and repairs the mistakes that can be repaired safely. Nothing is uploaded. The parsing happens in your browser. If the document is one long line, see how the validator formats it so the mistake is easy to find.
How these pages are written
Every broken JSON example fails to parse and every fixed one parses. On the Java pages, the broken and fixed code were both run, on Jackson or on Gson, and the messages are what they printed. On the C# pages the messages are what System.Text.Json and Newtonsoft.Json printed for the sample. A test checks each one. Written by Vishnu Shankar.