Fix JSON.parse “Unexpected token” errors

This error means your input is not valid JSON at a specific character position.

  1. Check for single quotes ('text') — JSON needs double quotes.
  2. Remove trailing commas in objects/arrays.
  3. Make sure you are parsing JSON, not HTML (responses starting with <).
  4. Verify escaped characters inside strings.
// Invalid
{'name':'Kim',}

// Valid
{"name":"Kim"}
Paste suspicious payloads into the JSON formatter to validate and pinpoint structure problems.