Unexpected character ('}' (code 125))
Jackson gives you the character it found, its decimal code, and then what it wanted instead. Read the second half first. "was expecting double-quote to start field name" means it was waiting for the next key, which is exactly what a trailing comma promises and never delivers.
How the message appears
Jackson wording. The number in brackets is the decimal code point of the character it found, which is what makes these messages searchable but unreadable.
The fix
Delete the comma before the closing } or ]. A comma goes between two values and never after the last one, which is exactly where a code generator or a hand edit tends to leave one.
{
"id": 7,
"tags": ["a", "b"],
}{
"id": 7,
"tags": ["a", "b"]
}The example travels in the URL fragment, which browsers never send to a server.
What causes it
(code 125): a trailing comma before a closing brace
The comma said another key was coming and the closing brace turned up instead. Jackson reports the brace, so the message points one line past the comma that caused it.
(code 93): a trailing comma inside an array
The same mistake, one level in. 93 is ].
(code 60): the document is HTML
60 is <. You have an error page, a login redirect or a proxy response. No amount of editing the JSON will help, because there is no JSON.
(code 39): single quotes
39 is '. Fine in JavaScript and Python source, never valid in JSON.
Worth knowing
- The codes you will actually run into: 123
{, 125}, 91[, 93], 44,, 58:, 34", 39', 60<, 10 newline. - A very low code like
(code 0)or(code 1)means you are parsing binary, or text that was decoded with the wrong charset. Look for a gzipped body being read as text, or a byte order mark.
Written by Vishnu Shankar.