JSON syntax error guide

JSON Unexpected Token Error: What It Means and How to Fix It

An unexpected token error means the parser reached a character that is not legal at that point in the JSON grammar. The character may be wrong itself, or an earlier missing comma, quote, brace, or bracket may have shifted the parser out of position.

What this JSON error means

Typical parser message
SyntaxError: Unexpected token ... in JSON at position ...

Start at the reported position, then inspect the token immediately before it. Parsers often report where they finally become unable to continue, while the actual mistake is one character earlier.

Broken JSON vs. corrected JSON

Compare the invalid syntax with a corrected version before applying the same change to your payload.

Invalid JSON

{"name":"Ada" "role":"engineer"}

Valid JSON

{"name":"Ada", "role":"engineer"}

Common causes of this JSON error

  • Missing comma between object properties or array values
  • Single quotes instead of required double quotes
  • Unquoted property names
  • A JavaScript-only value such as undefined, NaN, or Infinity
  • HTML or another non-JSON response being parsed as JSON

Fix and validate your JSON

After correcting the suspected syntax, run the complete payload through a validator. If it still fails, use the diagnostic tool to locate the next parser error before formatting the final JSON.

Related JSON errors

JSON error FAQ

What does JSON Unexpected Token Error mean?

An unexpected token error means the parser reached a character that is not legal at that point in the JSON grammar. The character may be wrong itself, or an earlier missing comma, quote, brace, or bracket may have shifted the parser out of position.

How do I fix JSON Unexpected Token Error?

Start at the reported position, then inspect the token immediately before it. Parsers often report where they finally become unable to continue, while the actual mistake is one character earlier.