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 / Use JsonReader.setLenient(true) to accept malforme
Gson · Java 21.0.12

Use JsonReader.setLenient(true) to accept malformed JSON at line L column C path $…

This message comes from Gson on Java 21.0.12. In this registry it is produced by 4 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: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10 path $

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

HTML received where JSON was expected

Input
<!DOCTYPE html>
<html><body>500</body></html>

Exact message: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $

Fix: Check the HTTP status and the Content-Type header before parsing. Log the first 200 characters of the body when parsing fails so the actual page is visible in your logs.

NDJSON fed to a whole-document JSON parser

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

Exact message: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 2 path $

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

Trailing characters after a JSON document

Input
{"a": 1} garbage

Exact message: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 11 path $

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
CPython json.loadsExpecting value: line L column C (char N)Extra data: line L column C (char N)
Gson JsonParser (lenient off)Use JsonReader.setLenient(true) to accept malformed JSON at line L column C path $…
JSON5JSON5: invalid character '<' at 1:1JSON5: 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 "…")malformed JSON string, neither array, object, number, string or atom, at character offset N (before "…")
Jackson ObjectMapperUnexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
JavaScriptCore JSON.parseJSON Parse error: Unable to parse JSON stringJSON Parse error: Unrecognized token '<'
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.Unexpected character encountered while parsing value: <. 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.Unexpected character encountered while parsing value: <. Path '', line L, position N.
Ruby JSON.parseunexpected token at '…'
SpiderMonkey JSON.parseJSON.parse: unexpected character at line L column C of the JSON dataJSON.parse: unexpected non-whitespace character after JSON data at line L column C of the JSON data
System.Text.Json Deserialize'<' is an invalid start of a value. Path: $ | LineNumber: L | BytePositionInLine: C.'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'<' is an invalid start of a value. LineNumber: L | BytePositionInLine: C.'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)Unexpected token '<', "…"... is not valid JSON
encoding/json Unmarshalinvalid character '<' looking for beginning of valueinvalid character 'g' after top-level valueinvalid character '{' after top-level value
hjsonFound EOF while looking for a key name (check your syntax) at line L,30Syntax 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 errorUnexpected '<'
json_decodeSyntax error
orjsonunexpected character, expected a JSON value: line L column C (char N)unexpected content after document: line L column C (char N)
serde_json::from_strexpected value at line L column Ctrailing characters at line L column C
ujsonExpected object or valueTrailing 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.