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
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
Unexpected End of JSON Input
Fix “Unexpected end of JSON input” errors caused by truncated JSON, missing braces or brackets, incomplete strings, and empty API responses.
Trailing Comma in JSON
Learn why trailing commas are invalid in standard JSON and fix objects or arrays copied from JavaScript, TypeScript, JSON5, or configuration files.
Single Quotes in JSON
Fix invalid JSON that uses single quotes. JSON requires double quotes around property names and string values.
JSON Property Names Must Be Double-Quoted
Fix JSON with unquoted object keys. Standard JSON requires every property name to be enclosed in double quotes.
Invalid Escape Character in JSON
Fix invalid JSON escape sequences in Windows paths, regex strings, copied text, and backslash-heavy values.
Comments Are Not Allowed in JSON
Learn why // and /* */ comments make strict JSON invalid, and when to use JSONC, JSON5, or separate metadata instead.
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.