format · validate · convert · runs locally

Fix "Trailing comma" in JSON

A trailing comma — a comma after the last item in an object or array — is not allowed in strict JSON, even though JavaScript object and array literals permit it. It is one of the most common reasons valid-looking JSON fails to parse.

The error

What causes it

JSON follows RFC 8259, which requires a value after every comma. So {"a":1,} and [1,2,] are invalid: the parser reads the comma, then expects another key or value and instead finds a closing } or ]. In JavaScript this surfaces as Unexpected token }; in Python as Expecting property name enclosed in double quotes.

How to fix it

Remove the comma before the closing brace or bracket. If you have many of them, paste the JSON into the validator below to locate each one, or use the JSON Repair tool to strip all trailing commas automatically and re-format the result.

Paste your JSON to find the problem

The validator below runs entirely in your browser and flags the exact line and column of the first error.

Frequently asked questions

Are trailing commas allowed in JSON?

No. Strict JSON (RFC 8259 / ECMA-404) forbids a comma after the last element of an object or array. This differs from JavaScript, JSON5, and many config formats, which do allow it.

How do I remove trailing commas automatically?

Use the JSON Repair tool — it strips trailing commas (plus single quotes, comments, and unquoted keys) and re-formats. Or paste into the validator below to fix them by hand at the flagged position.

Why does JavaScript allow trailing commas but JSON does not?

Trailing commas are a JavaScript syntax convenience for editing literals. JSON is a stricter data-interchange subset and deliberately omits them for unambiguous parsing across languages.