Trailing comma in JSON: "Expected double-quoted property name"
By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test
JSON does not allow a comma after the last item in an object or array. JavaScript, Python and JSON5 do, which is why the mistake is so common. Most parsers never mention the comma: after a comma they expect another property name, find a }, and complain about that.
What each runtime prints
We ran this input through JSON.parse in each browser and Node version, and through json.loads in Python. These are the messages exactly as printed.
{"name": "Ada", "age": 36,}| Runtime | Exact message |
|---|---|
| Chrome 151Node 24Node 22 | Expected double-quoted property name in JSON at position 26 (line 1 column 27) |
| Firefox 153 | JSON.parse: expected double-quoted property name at line 1 column 27 of the JSON data |
| Safari 26 (WebKit)Bun | JSON Parse error: Property name must be a string literal |
| Node 20 | Expected double-quoted property name in JSON at position 26 |
| Node 18 | Unexpected token } in JSON at position 26 |
| Python 3.13 | JSONDecodeError: Illegal trailing comma before end of object: line 1 column 26 (char 25) |
| Python 3.12Python 3.10 | JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 27 (char 26) |
- Python 3.13 added a message that names the problem: "Illegal trailing comma before end of object". Python 3.12 and older say "Expecting property name enclosed in double quotes", which sounds like a quoting problem.
- Python 3.13 points at the comma itself (column 26). Every other parser points at the } after it (column 27).
- Safari says "Property name must be a string literal" and gives no position at all.
- In an array the messages change. Node 24 says "Unexpected token ']', "[1, 2,]" is not valid JSON" for [1, 2,], and Python 3.13 says "Illegal trailing comma before end of array".
Edit it or paste your own. It runs in your browser; nothing is uploaded.
Common causes
- 1
A hand-edited file
Deleting the last item of a list, or copying a line from the middle to the end, leaves its comma behind.
- 2
JavaScript or Python habits
Both languages allow trailing commas, and code formatters often add them. JSON copied from a code file keeps them.
- 3
JSON built by string concatenation
A loop that appends `"item",` for every item leaves a comma after the last one.
- 4
A config file read by a strict parser
Some tools read their config as JSONC, which allows trailing commas and comments. The same file fails when another tool reads it with a plain JSON parser.
How to fix it
Delete the comma before the } or ]. If a program writes the JSON, let the serializer build it so the commas are always right.
JavaScript
// Instead of building the string by hand:
const body = JSON.stringify({ name: 'Ada', tags: ['math', 'engines'] });Python
import json
body = json.dumps({"name": "Ada", "tags": ["math", "engines"]})- For a large file, the column in the Chrome, Node or Firefox message lands on the } right after the comma.
- If the file is meant to be JSONC (with comments and trailing commas), read it with a JSONC parser, such as the jsonc-parser package in Node, instead of JSON.parse.