Fix JSON.parse “Unexpected token” errors
This error means your input is not valid JSON at a specific character position.
- Check for single quotes ('text') — JSON needs double quotes.
- Remove trailing commas in objects/arrays.
- Make sure you are parsing JSON, not HTML (responses starting with <).
- Verify escaped characters inside strings.
// Invalid
{'name':'Kim',}
// Valid
{"name":"Kim"}Paste suspicious payloads into the JSON formatter to validate and pinpoint structure problems.
Related: JSON escaping guide
Continue with related guides
Browse the full guides hub or open the JSON formatter tool.