ENRU

JSON Position Finder

Position 1234 means nothing. Line 7 does.

Input

Paste the document here and the message above. I’ll find the spot.

Ctrl+Enter finds · drop a file on this pane

Every parser counts. Not every parser counts the same way.
— JSON Statham
Output
Example: a message with position 68 in, line 5 and column 1 out.
Waiting for a document and a message.
Ln 1, Col 11:10 Blocal

Paste the error message from your parser and the JSON it was reading. The finder reads the position the way that parser counts — UTF-16 units, characters or bytes, from 0 or from 1 — and shows the exact spot. It runs in your browser.

How to find a JSON error position

  1. Paste the message: “at position 1234”, “line 7 column 3 (char 210)”, “offset 98” or “BytePositionInLine: 12”.
  2. Paste the JSON the parser read, exactly as it was. For a file with Windows line breaks, tick CRLF.
  3. See the line, column and character; Show me puts the cursor on it.

Position, char, offset: why JSON parsers disagree

JavaScript counts UTF-16 code units from 0, Python counts characters from 0, and Go, .NET and MySQL count bytes. An emoji is 2 units, 1 character and 4 bytes, so one spot has three numbers. Next to the spot, the finder lists all of them, so any log line points to the same place.

JSON position finder FAQ

What does “Unexpected token in JSON at position 0” mean?

Position 0 is the very first character: the response wasn’t JSON at all. Most often it is an HTML error page or an empty body, so check the status code and the raw response before parsing.

Is the position counted from 0 or from 1?

Offsets — position, char, offset — count from 0; lines and columns usually count from 1. .NET is the exception: LineNumber and BytePositionInLine both count from 0.

Why is the spot off by a few characters?

Either the text is not the one the parser read, or the file had Windows (CRLF) line breaks: each is two characters in the file and one in a browser text field. Tick CRLF and look again.

Which messages does it understand?

Node.js and Chrome, Python, Firefox, .NET System.Text.Json, MySQL, RapidJSON, Go encoding/json and jq, plus any “line L column C” and a bare number.

Other tools

Keyboard shortcuts

Everywhere
Ctrl+EnterRun the page’s main action
Ctrl+OOpen a file
F8 / eJump to the error
/Focus the input
qAnother quote
?This help
EscClose

Keys like q, e work when the cursor isn’t in an editor.