Expected double-quoted property name in JSON
After a comma inside an object, JSON requires another key, and a key must be a string in double quotes. When this message appears, the parser met a comma, looked for that key, and found the closing brace instead. In other words, the object ends with a trailing comma. That covers the great majority of cases, and the position points at the brace.
Input
{"id": 7, "name": "Ada",}Do
- Paste the input into the validator.
- Press Repair in the editor band.
Result
Removed trailing commas
{"id": 7, "name": "Ada"}| Runtime | Message |
|---|---|
| Chrome 153 · Node.js 26 | Expected double-quoted property name in JSON at position 24 (line 1 column 25) |
| Node.js 18 (older V8) | Unexpected token } in JSON at position 24 |
| Firefox 156 | JSON.parse: expected double-quoted property name at line 1 column 25 of the JSON data |
| Safari 26 | JSON Parse error: Property name must be a string literal |
| Python 3.14 json | Illegal trailing comma before end of object: line 1 column 24 (char 23) |
| This site | Trailing comma before "}"line 1, column 24 |
Recorded from each runtime; the wording is in Firefox’s, Safari’s and Python’s sources.
Legal in JavaScript, never in JSON
JavaScript has accepted a comma after the last property of an object literal for many years, and plenty of style guides require one because it keeps diffs clean when a line is added. JSON was frozen before that habit spread and has never allowed it, in objects or in arrays. So a trailing comma usually means a snippet was copied from JavaScript source, or someone edited a JSON file by hand, deleted the last entry and kept its comma. A template that prints a comma after every item of a loop produces the same thing at scale.
Configuration files are the other big source. Several tools read a relaxed dialect that tolerates trailing commas and comments, so a file that works in one program fails the moment a strict parser reads it.
The message is different in an array
For a comma before ], current Chrome and Node.js do not mention property names; they report the bracket itself, as in Unexpected token ']', "[1, 2, 3,]" is not valid JSON, and Firefox reports an unexpected character. Python 3.14 is the clearest of all and names the problem outright in both cases, with an illegal trailing comma before the end of an object or of an array. Safari says a property name must be a string literal. And Node.js 18 printed Unexpected token } in JSON at position 24, which is the same trailing comma in its older wording.
If there is no trailing comma, look for a key that really is not double-quoted, such as {"id": 7, name: "Ada"}. A bare or single-quoted key after a comma gets this same message, while one right after the opening brace gets Expected property name or '}' instead.
Removing every one at once
Deleting commas by hand is fine for one, and tedious for a file where a generator added one to every object. Paste the document into the JSON Validator to see where the first one is, then press Repair: it removes trailing commas from every object and every array in the document in a single pass, and the status bar says how many it took out. The rest of the text, including its indentation and line breaks, is left exactly as it was, so the change is easy to review, and one undo reverses it.
A regular expression such as ,\s*} looks like a shortcut and is not one: it also rewrites a comma followed by a brace inside a string value. Repair reads strings as strings and only touches commas that are part of the structure. The guide to fixing invalid JSON has a worked example with trailing commas, comments and bare keys in the same file.
Catch them before they ship
Hand-edited JSON files are where trailing commas keep coming back, so a check that runs a strict parser over every .json file in the repository pays for itself quickly. Python's standard library already has one: python -m json.tool settings.json prints the file when it is valid and exits with status 1 and the illegal-trailing-comma message when it is not, which is all a pre-commit hook or a CI step needs. Run it on generated files too, since a template that emits a comma after every item fails only when someone adds the last entry by hand.