Formatter Validator Minifier Escape / Unescape JSON ↔ String JSON ↔ YAML JSON → CSV NDJSON / JSON Lines JSON → Types JSON ↔ XML JSON Diff JSON Patch Canonicalize (RFC 8785) Schema Validator Schema Generator JSONPath Tester JWT Decoder JSON Errors Schemas More Tools
JSONTools / JSON errors / Extra data: line L column C (char N)
CPython json.loads · CPython 3.12.3

Extra data: line L column C (char N)

This message comes from CPython json.loads on CPython 3.12.3. In this registry it is produced by 3 distinct mistakes. Positions in the real message vary with your input; the causes do not.

What produces this message

Extra data after a JSON document

Input
{"a": 1}{"b": 2}

Exact message: Extra data: line 1 column 9 (char 8)

Fix: Split the documents, or if you meant a stream of records, use NDJSON and parse one line at a time.

NDJSON fed to a whole-document JSON parser

Input
{"a":1}
{"a":2}

Exact message: Extra data: line 2 column 1 (char 8)

Fix: Read line by line and parse each line separately.

Trailing characters after a JSON document

Input
{"a": 1} garbage

Exact message: Extra data: line 1 column 10 (char 9)

Fix: Trim everything after the final closing brace, and check whatever produced the file for stray writes to stdout.

What other parsers say about the same input

If a colleague reports a different message for what looks like the same file, this is why.

Parser Message for the same inputs
GsonUse JsonReader.setLenient(true) to accept malformed JSON at line L column C path $…
Gson JsonParser (lenient off)Use JsonReader.setLenient(true) to accept malformed JSON at line L column C path $…
JSON5JSON5: invalid character 'g' at 1:10JSON5: invalid character '{' at 1:9JSON5: invalid character '{' at 2:1
JSON::PPgarbage after JSON object, at character offset N (before "…")
JavaScriptCore JSON.parseJSON Parse error: Unable to parse JSON string
Newtonsoft.Json JsonConvertAdditional text encountered after finished reading JSON content: g. Path '', line L, position N.Additional text encountered after finished reading JSON content: {. Path '', line L, position N.
Newtonsoft.Json JsonTextReaderAdditional text encountered after finished reading JSON content: g. Path '', line L, position N.Additional text encountered after finished reading JSON content: {. Path '', line L, position N.
Ruby JSON.parseunexpected token at '…'
SpiderMonkey JSON.parseJSON.parse: unexpected non-whitespace character after JSON data at line L column C of the JSON data
System.Text.Json Deserialize'g' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: L | BytePositionInLine: C.'{' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: L | BytePositionInLine: C.
System.Text.Json JsonDocument'g' is invalid after a single JSON value. Expected end of data. LineNumber: L | BytePositionInLine: C.'{' is invalid after a single JSON value. Expected end of data. LineNumber: L | BytePositionInLine: C.
V8 JSON.parseUnexpected non-whitespace character after JSON at position N (line L column C)
encoding/json Unmarshalinvalid character 'g' after top-level valueinvalid character '{' after top-level value
hjsonSyntax error, found trailing characters at line L,1 >>>{"a":2} {"a":3} ...Syntax error, found trailing characters at line L,8Syntax error, found trailing characters at line L,9
json-bigintSyntax error
json_decodeSyntax error
orjsonunexpected content after document: line L column C (char N)
serde_json::from_strtrailing characters at line L column C
ujsonTrailing data

← All JSON parser errors

Standards this registry is checked against

Only standards bodies and peer-reviewed venues are cited. Error strings on this site are observed by executing each parser; the standards above define what the parser is reacting to.