Fix Trailing Comma in JSON Online

Paste JSON that JavaScript accepts and JSON.parse rejects. Auto-Fix Errors rewrites the common mistakes in this browser and writes valid JSON to the result panel. Nothing is uploaded.

Input

Size
0 B
Lines
0
Keys
0
Depth
0

JavaScript literals vs RFC 8259 JSON

JavaScript lets you write { "a": 1, }, { a: 1 }, { 'a': 'b' }, and // comments. RFC 8259 JSON does not. JSON.parse follows the stricter rules, so a file exported from a JavaScript object, a config with comments, or a snippet copied from code can fail even though it looks familiar.

Trailing comma

Before: {"skills":["JSON",]}. After auto-fix: {"skills":["JSON"]}. The comma after the last value is removed. Commas between values stay.

Comments and quotes

Auto-Fix strips // and /* */ comments that sit outside strings, converts single-quoted strings, and quotes unquoted keys. A comment inside a string, such as "use // here", is left alone. The status line says what changed, for example how many trailing commas were removed.

Beautify and Validate still refuse invalid JSON and report the line and column. Use Auto-Fix when you want the repair. If the text is an HTML error page rather than JSON with a trailing comma, use Fix JSON.parse unexpected token.

Frequently Asked Questions

Why is a trailing comma invalid JSON?

RFC 8259 allows a comma only between values. JavaScript object and array literals allow a final comma, and JSON.parse does not.

Does Auto-Fix upload the JSON?

No. Trailing commas, comments, single quotes, unquoted keys, and a leading BOM are repaired in this browser.

What does Auto-Fix change?

It removes trailing commas, strips // and /* */ comments outside strings, converts single-quoted strings to JSON strings, quotes unquoted keys, converts Python True, False, and None, and drops a leading BOM. Then it parses the result.

Will Auto-Fix change JSON that is already valid?

It reports that no common errors were found and writes a beautified copy. It does not invent new keys.

Does Auto-Fix remove a comment that is inside a string?

No. Comment markers inside a quoted string stay part of that string.