Unexpected Token in JSON – Find the Error

Local only

An unexpected token error means the parser found a character or value that cannot appear at that position in valid JSON. The reported token is often where the parser notices an earlier syntax mistake.

Indent

36 chars · 4 lines

Two-way sync · Edit either side and the other updates automatically.

Invalid JSONExpected ',' or '}' after property value
Line 3Column 3Character 21Found “"”
"active": true

JSON parser error

How to locate an unexpected JSON token

Unexpected token is a broad parser message rather than one specific JSON mistake. The checker above preloads an object with a missing comma so you can see that the token highlighted by the parser can be the next property even though the missing punctuation is just before it. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Browser-local JSON processing
  • Route-specific malformed JSON example
  • Focused parser or repair guidance
  • Broken and corrected JSON example
  • Related JSON problem navigation

Steps

  1. Paste the exact text that produced the parser error.
  2. Inspect the reported token and the characters immediately before it.
  3. Correct the surrounding syntax, then confirm the document parses completely.

The reported token may be after the actual mistake

Parsers usually fail when the next token makes the current grammar impossible. A missing comma after one property may therefore be reported at the quotation mark that begins the following property.

  • Check for a missing comma or colon before the token.
  • Check whether quotes, braces, or brackets were left open.
  • Confirm the response is JSON rather than HTML or plain text.

Preserve the original response while debugging

When the input comes from an API, log or inspect the raw response before parsing it. That makes it easier to distinguish malformed JSON from an unexpected server response or an extra prefix added by middleware.

Unexpected token caused by a missing comma

The parser reaches the next property name, but the actual fix is to add a comma after the previous string value.

Invalid JSON

{
  "name": "Ada"
  "active": true
}

Valid JSON

{
  "name": "Ada",
  "active": true
}

Common questions

Frequently asked questions

What does Unexpected token in JSON mean?

It means the parser encountered a token that is not legal at the current grammar position. The underlying cause may be the token itself or missing syntax immediately before it.

Why does the token point to the next property?

A parser can continue until the next token proves the previous structure is incomplete, so a missing comma is commonly reported at the following key.

Can a server response cause an unexpected token error?

Yes. HTML, plain text, login pages, proxy errors, and other non-JSON bodies can all fail when application code tries to parse them as JSON.

Debugging a specific JSON issue? Browse JSON troubleshooting.