Why it happens
A comma inside an object promises one more "key": value pair, and the parser reports the first character after it. In the sample, Chrome points at the } on line 5, while the mistake is the comma at the end of line 4; the checker highlights the comma itself. Causes, likeliest first:
1. A trailing comma before }. You deleted or moved the last property, or copied the object from JavaScript, where that comma is legal.
2. A commented-out last property.
{
"host": "db.internal",
"port": 5432,
// "ssl": true
}
Two problems at once: the comma after 5432 and the comment. Chrome reports the / at line 4, column 3.
3. An unquoted or single-quoted key after the first one. {"sku": "PEN-7", qty: 3} fails on the q. On the first key, the same mistake gives Expected property name or ‘}’.
4. JSON built by string concatenation. A loop that writes a comma after every item leaves one before the closing brace:
const limits = { cpu: 2, memoryMb: 512 };
let json = '{';
for (const [key, value] of Object.entries(limits)) {
json += `"${key}": ${value},`;
}
json += '}'; // {"cpu": 2,"memoryMb": 512,}
How to fix Expected double-quoted property name
Delete the comma
Remove the comma after the last property. In a long file, go to the reported line and check the end of the line above. The JSON validator shows it as Trailing comma before '}', and JSON Repair removes every trailing comma and comment in one pass.
Stop building JSON by hand
A serializer never writes a trailing comma:
const json = JSON.stringify(limits);
Config files that people edit
To allow trailing commas and comments in a hand-edited file, parse it as JSONC:
import { readFileSync } from 'node:fs';
import { parse } from 'jsonc-parser';
const errors = [];
const config = parse(readFileSync('worker.json', 'utf8'), errors, { allowTrailingComma: true });
if (errors.length) throw new Error(`worker.json has ${errors.length} syntax error(s)`);
jsonc-parser never throws, so check the errors array. Keep files that other programs read in strict JSON. For comments, see Can JSON have comments?
Same error in other languages
- Firefox uses the same words:
JSON.parse: expected double-quoted property name. - Python 3.13+:
JSONDecodeError: Illegal trailing comma before end of object: line 4 column 36 (char 81)for the sample, pointing at the comma. Older versions sayExpecting property name enclosed in double quotesat the character after it. - Go:
invalid character '}' looking for beginning of object key string. - VS Code marks the comma as
Trailing comma, and comments as Comments are not permitted in JSON.
For other messages, see common JSON errors.