Invalid JSON — Trailing Comma
Download a free JSON file containing trailing commas — the single most common JSON syntax error in web development. This file is valid JavaScript but invalid JSON, making it perfect for testing the boundary between lenient and strict JSON parsing.
What Is Broken
Trailing commas appear after the last element in both arrays and objects. While JavaScript engines and JSON5 parsers accept this, the strict JSON specification (RFC 8259) explicitly forbids it.
Broken Example
{
"users": [
{"name": "Alice", "role": "admin"},
{"name": "Bob", "role": "user"},
],
"total": 2,
}Why It Matters
This is the #1 most common JSON error in production. It happens when developers copy JavaScript object literals into JSON config files, when code generators don't handle the last-element edge case, or when manual edits leave a dangling comma.
Expected Parser / Validator Behavior
JSON.parse() throws 'Unexpected token }' or 'Expected double-quoted property name'. Python raises JSONDecodeError. Most APIs return 400 Bad Request.
Related Invalid Files
Related Validators & Tools
Valid Sample Files
Frequently Asked Questions
Why do trailing commas break JSON?
The JSON grammar defines arrays as [value, value] and objects as {key:value, key:value}. A comma after the last element doesn't match this grammar.
Which parsers allow trailing commas?
JavaScript eval(), JSON5 parsers, and some lenient parsers. Standard JSON.parse(), Python json, Java Jackson, and Go encoding/json all reject them.