A message like "Unexpected token } in JSON at position 47" looks intimidating the first time you see it, but every JSON parsing error follows the same basic anatomy once you know what to look for.
Breaking down the error
The error names the unexpected character, then gives you a position — the character index where the parser gave up. Most editors and JSON tools let you jump straight to that position, which is usually just before or at the actual mistake.
What each common phrase usually means
- "Unexpected token }" — likely a trailing comma or a missing value
- "Unexpected end of JSON input" — a closing bracket or brace is missing somewhere
- "Unexpected token in JSON at position 0" — the input isn't JSON at all, often an empty string or an HTML error page
Let a validator do the counting for you
Manually counting characters to position 47 in a large payload is tedious and error-prone. A JSON formatter and validator will visually highlight exactly where things broke, so you can fix the actual syntax issue instead of hunting for it by hand.
Ready to try it? Jump back up to the JSON Formatter & Validator.