How to Fix a Trailing Comma Error in JSON
4 min read · Updated 2026-07-15
A trailing comma is one of the most common reasons valid-looking JSON fails to parse. JSON is stricter than JavaScript object syntax: the final item in an object or array cannot be followed by a comma.
What the error looks like
The parser usually reports an unexpected token near a closing brace or bracket. The real problem is the comma immediately before it.
{
"name": "YouKit",
"private": true,
}How to fix it
Remove the comma after the final property or array item, then validate the document again. Keep commas only between adjacent values.
{
"name": "YouKit",
"private": true
}Find the exact location
Paste the document into the JSON Validator. It reports the parser message and, when the runtime provides a position, the corresponding line and column. Your data stays in the browser.
Frequently asked questions
Are trailing commas allowed in JSON?
No. Standard JSON does not permit a trailing comma after the last object property or array item.
Why does JavaScript accept a trailing comma?
JavaScript object and array literals follow JavaScript syntax, while JSON follows a smaller and stricter data format.