Unexpected non-whitespace character after JSON at position N (line L column C)
A JSON document contains exactly one top-level value. The parser read a complete one, then found something else after it. The position it reports is where the extra content starts, which is usually the beginning of the second record.
Paste your JSON and see exactly where it breaks
Nothing you paste leaves your browser. The connect-src allowlist makes that a browser guarantee rather than a promise. Check it yourself
What actually causes it
Ranked by how often each one turns out to be the answer.
-
01 The input is NDJSON or JSON Lines
One complete JSON value per line, with no commas and no wrapping array. This is the format used by log pipelines, BigQuery exports, Elasticsearch bulk operations and streaming LLM APIs. It is not broken JSON; it is a different format that has to be read line by line.
Breaks
{"event":"login"} {"event":"logout"}Works
const records = text .split('\n') .filter((line) => line.trim()) .map((line) => JSON.parse(line)); -
02 Two responses were concatenated
A retry that appended rather than replaced, or a stream read that joined two chunks without separating them.
-
03 Debug output was appended to the body
A stray print, an echoed warning, or profiling output written after the JSON. The document parses right up to the point where the extra text begins, which is exactly where the position points.
-
04 The value is double encoded
A JSON string containing JSON, unwrapped once too few or once too many times. Our unescape tool detects how many layers of encoding a value has.
The same mistake in other runtimes
The underlying problem is identical; only the wording differs. If a colleague reports one of these, they are looking at the same thing you are.
| Python | Extra data: line 2 column 1 (char 8) |
|---|---|
| Firefox | JSON.parse: unexpected non-whitespace character after JSON data |
Questions
- How do I tell if my file is NDJSON?
- Every non-empty line parses as complete JSON on its own, there are no commas between records, and there is no wrapping [ ]. Paste it into our validator and it will say so and offer to wrap the records in an array.
- Can I just wrap it in brackets and add commas?
- Yes, and for a small file that is the quickest fix. For a large one, reading it line by line uses far less memory, which is the reason the format exists.
Fix it now
Paste the payload into the tool above, or go straight to the one built for this job.
Convert NDJSON to JSON