Trailing Comma in JSON: What It Means and How to Fix It
Standard JSON does not allow a comma after the final property in an object or the final value in an array. JavaScript and several JSON-like formats permit trailing commas, which makes this one of the most common copy-and-paste failures.
What this JSON error means
SyntaxError near a trailing comma before } or ]Look immediately before each closing brace and bracket. If the previous non-whitespace character is a comma, remove it for strict RFC 8259 JSON.
Broken JSON vs. corrected JSON
Compare the invalid syntax with a corrected version before applying the same change to your payload.
Invalid JSON
{"name":"Ada","active":true,}Valid JSON
{"name":"Ada","active":true}Common causes of this JSON error
- ●Copying a JavaScript or TypeScript object literal into a .json file
- ●Formatting tools configured to preserve trailing commas
- ●Deleting the last item but leaving its comma behind
- ●Confusing JSON with JSON5 or JSONC
Fix and validate your JSON
After correcting the suspected syntax, run the complete payload through a validator. If it still fails, use the diagnostic tool to locate the next parser error before formatting the final JSON.
Related JSON errors
JSON Unexpected Token Error
Understand and fix JSON unexpected token errors. See broken and corrected examples, common causes, and a fast workflow for finding the exact invalid character.
Unexpected End of JSON Input
Fix “Unexpected end of JSON input” errors caused by truncated JSON, missing braces or brackets, incomplete strings, and empty API responses.
Single Quotes in JSON
Fix invalid JSON that uses single quotes. JSON requires double quotes around property names and string values.
JSON Property Names Must Be Double-Quoted
Fix JSON with unquoted object keys. Standard JSON requires every property name to be enclosed in double quotes.
Invalid Escape Character in JSON
Fix invalid JSON escape sequences in Windows paths, regex strings, copied text, and backslash-heavy values.
Comments Are Not Allowed in JSON
Learn why // and /* */ comments make strict JSON invalid, and when to use JSONC, JSON5, or separate metadata instead.
JSON error FAQ
What does Trailing Comma in JSON mean?
Standard JSON does not allow a comma after the final property in an object or the final value in an array. JavaScript and several JSON-like formats permit trailing commas, which makes this one of the most common copy-and-paste failures.
How do I fix Trailing Comma in JSON?
Look immediately before each closing brace and bracket. If the previous non-whitespace character is a comma, remove it for strict RFC 8259 JSON.