Why trailing commas break JSON
The JSON grammar only allows a comma between two values. A comma followed directly by } or ] means another value was expected, so every strict parser stops there. JavaScript, TypeScript, Python and most config formats accept the extra comma, which is why it sneaks in so often when JSON is edited by hand or generated from code.
What the error looks like
- Chrome / Edge / Node.js, object:
Expected double-quoted property name in JSON at position 7 - Chrome / Edge / Node.js, array:
Unexpected token ']', "[1,2,]" is not valid JSON - Older browsers:
Unexpected token } in JSON at position 7 - Firefox:
JSON.parse: expected double-quoted property nameorunexpected character, with a line and column - Python 3.13+:
JSONDecodeError: Illegal trailing comma before end of object(orof array); older Python:Expecting property name enclosed in double quotesorExpecting value
How to fix it
- Paste the JSON into the input pane, or open the file.
- Press Quick Fix. Each removed comma is listed with its line.
- Copy or download the valid result, or press Replace input with fixed JSON to keep editing.
To prevent it, let your language's serializer write the file (JSON.stringify, json.dumps) instead of building JSON by hand, and turn on a linter rule such as comma-dangle for files that must stay strict JSON.
Frequently asked questions
Are trailing commas allowed in JSON?
No. The JSON specification (RFC 8259) does not allow a comma after the last element of an object or array. JSON5 and JSONC allow them, but standard parsers such as JSON.parse and Python's json module reject them.
Will removing the comma change my data?
No. A trailing comma carries no value, so deleting it leaves every key and value exactly as it was.
Can it fix many trailing commas at once?
Yes. Quick Fix removes every trailing comma in the document in one pass and reports how many it removed and on which lines.