W

Unexpected Token in JSON

An 'Unexpected token' error from JSON.parse means the parser hit a character that is not valid JSON at that position. The token might be a single quote, a trailing comma, an unquoted key, or a comment marker. The error message usually includes a position or line number pointing to the mistake.

Common causes

Trailing commas after the last array or object item, single-quoted strings, JavaScript-style unquoted keys, and `//` or `/* */` comments are the most frequent causes. JSON is stricter than JavaScript object literals.

How to fix

Use a JSON validator with line and column reporting. Fix the first error before re-running — later errors are often cascading. Remove comments or convert to JSON5 if your stack supports it.

Related tools

Paste your payload into the JSON Validator for live syntax checks, then format valid JSON with the JSON Formatter before sending to an API.

Related tools

Related guides