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.
Related JSON guides
How to Fix Invalid JSON: A Practical Error-Checking Guide
Find the first JSON syntax error, understand common parser messages, and fix invalid JSON without changing valid data.
How to Fix Unexpected Token Errors in JSON
Learn what an unexpected token means in JSON, identify the character that caused it, and repair common syntax mistakes.
JSON Formatter vs JSON Validator: When to Use Each Tool
Understand the difference between formatting and validating JSON, choose the right workflow, and keep data private in your browser.