JSON Trailing Comma Error

JSON syntax does not allow a comma after the last element in an object or array. Many languages do, but JSON spec does not.

Common causes

How to fix

Examples

Bad

[1, 2, 3,]

Good

[1, 2, 3]

FAQ

Why does JSON not allow trailing commas?
The JSON spec was designed to be minimal; trailing commas were omitted to avoid ambiguity.
Does JavaScript JSON.parse allow trailing commas?
No. Standard JSON does not; only JavaScript object literals can have trailing commas.

Fix it now

Try in validator (prefill this example)

Related

All tools · Canonical