JSON Errors

Most JSON errors come from a small set of syntax problems. Learn what they mean and how to fix them.

Unexpected token

This means the parser found a character it did not expect. Common causes are unquoted keys, single quotes and extra commas.

{"name": Alice}

Fix: wrap values and keys in double quotes.

Unexpected end of input

The document stops before all objects and arrays are closed.

{"name":"Ada"

Fix: add the missing } or ].

Trailing comma

Commas after the final item are not valid JSON.

["a", "b",]

Fix: remove the comma after the last value.

Invalid character

Control characters and unsupported symbols must be escaped inside strings.

"line1
line2"

Fix: replace the newline with \n.