JSON Formatter & Validator

Trailing comma in JSON: "Expected double-quoted property name"

Why a comma after the last item breaks JSON, the exact error messages in Chrome, Node.js and Python, and how to fix it.

Error messages you may see

Chrome · Edge · Node.jsSyntaxError: Expected double-quoted property name in JSON at position 32 (line 4 column 1)
Older Chrome · Node.js 18 and earlierSyntaxError: Unexpected token } in JSON at position 32
Python json.loadsjson.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 4 column 1 (char 32)
This toolLine 4, Col 1: Trailing commas are not allowed

Why it happens

JSON does not allow a comma after the last item of an object or array. JavaScript, Python and many config formats accept it, so it often sneaks in when JSON is written by hand or when the last line is deleted.

Invalid

{
  "name": "Kim",
  "age": 30,
}

How to fix

Delete the comma right before the closing } or ]. If a file has many of them, paste it into the formatter and press Auto-fix.

Fixed

{
  "name": "Kim",
  "age": 30
}

Open this example in the JSON formatter →

Tip: the formatter fixes this in one click with the 🔧 Auto-fix button.

Other common JSON errors