Article

JSON Parse Error at Position Explained

What 'JSON parse error at position' means and how to find the exact character. Use line and column from a validator to fix syntax errors quickly.

What Is "Position" in a JSON Parse Error?

Position is the index in the raw string: 0 is the first character, 1 the second, and so on. So "at position 42" means the 43rd character. In a minified JSON string that's hard to locate by eye. Tools that convert position to line and column make debugging much easier.

From Position to Line and Column

Our JSON validator and JSON formatter parse the error message, extract the position when the engine provides it, and compute the corresponding line and column. You see something like "Invalid JSON: Unexpected token (line 3, column 12)" so you can jump straight to that spot.

Common Errors at a Given Position

At the reported position you might find: a trailing comma, a missing comma between properties, an unescaped quote inside a string, a single quote instead of double, or an invalid number (e.g. 01 or .5 without a leading zero). Fix that character or the surrounding syntax and validate again.

Validate JSON in JavaScript

In code, JSON.parse(str) throws a SyntaxError. The message may include the position. For a user-friendly experience, run the string through a validator that shows line/column, or see our article on how to validate JSON in JavaScript.

Summary

"JSON parse error at position N" means the parser failed at the Nth character. Use a JSON validator that reports line and column to find and fix the error. For related fixes see fix unexpected token in JSON and developer tools.