Unexpected token in JSON usually means the parser tripped on one bad character.
The wording sounds vague, but the pattern is predictable. The parser expected a valid JSON token and found something else instead. That can be a stray opening character, a missing comma, an unquoted key, or invalid quotes.
What the error usually means
The parser expected one valid JSON token and found something else instead. That unexpected character might be the real mistake, or it might be where the parser finally noticed an earlier problem.
If the message says unexpected token at position 0, start by checking the very first character of the payload.
Broken patterns that trigger it
Invalid starting character
JSON must start with a valid JSON value. A stray leading character breaks parsing immediately.
Missing comma between properties
The parser reaches the next key and realizes the comma between siblings never happened.
Malformed key or invalid quotes
Unquoted keys and invalid quote characters both show up as unexpected token failures.
Position 0 is its own clue
If the error points to position 0, the parser is unhappy with the very first character of the payload.
That often means you are not looking at JSON at all. It could be HTML, a JavaScript object literal, a stray letter, or a response body that starts with some other format.
How to find the real cause
- 1Read the unexpected token message and note the reported position or line.
- 2Look just before that location for a missing comma, colon, quote, or bracket.
- 3Check the start of the payload if the error mentions position 0.
- 4Validate again after the fix and then format the corrected JSON.
Quick answers
What to do next
Start with the right tool now, then move back to the hub or sideways into the adjacent guides if the first answer was not the whole fix.
Use JSON Validator
Validate the payload to see the exact token, line, and position that triggered the parse error.
Use JSON Formatter
Format the corrected JSON after the parser error is resolved.
Back to Common JSON Errors
Return to the overview page for this JSON error family and branch into the matching fix.
JSON Single Quotes vs Double Quotes
Single quotes breaking your JSON? Here's exactly why they're invalid, where the rule comes from, and how to fix it fast.
JSON Parse Error Line and Column
JSON parse error line and column messages help narrow the search, but the real syntax issue can be slightly earlier. Learn how to read the location properly.