Trailing comma in JSON
Expected double-quoted property name in JSON at position 8 (line 1 column 9) (the engine does not say "trailing comma" — it reports what it found instead of the expected next token)
JSON strictly forbids trailing commas — a comma after the last element of an object or array is a syntax error. JavaScript itself allows trailing commas in object and array literals as of ES5, which leads developers to write JSON in the same style. The engine error message is indirect: instead of saying "trailing comma", it says it expected a property name (for objects) or a value (for arrays) and found "}" or "]" instead. If you see the validator complaining about position N where a closing bracket sits, a trailing comma is the most likely culprit.
Trailing comma in an object
The last key-value pair in a JSON object must NOT be followed by a comma. This is the most frequent hand-editing mistake.
Invalid
{
"name": "Alice",
"age": 30,
}Valid
{
"name": "Alice",
"age": 30
}Trailing comma in an array
The same rule applies to arrays. A comma after the last element makes the JSON invalid, even though JavaScript arrays accept it.
Invalid
[1, 2, 3,]
Valid
[1, 2, 3]
Copy-pasted from JavaScript source code
JavaScript object and array literals support trailing commas as a linting best practice. When that code is copy-pasted into a .json file, the commas come along and break parsing.
Invalid
// Valid JS — invalid JSON
const config = {
timeout: 5000,
retries: 3,
}Valid
{
"timeout": 5000,
"retries": 3
}Fix this error in seconds
Paste your JSON in the free validator to find the exact line and column where the error occurs.
Open JSON Validator →Frequently Asked Questions
Why does JSON forbid trailing commas when JavaScript allows them?
JSON was specified as a strict subset of JavaScript to be maximally portable across languages. The original JSON RFC (and every subsequent revision) deliberately omitted trailing commas to keep parsers simple. JavaScript itself added trailing comma support as a language convenience feature years after JSON was standardized, so the two formats diverged on this point.
Is there a JSON variant that supports trailing commas?
Yes. JSON5 and JSONC (JSON with Comments) both support trailing commas and are used in config files like tsconfig.json and .vscode/settings.json. However, they require a dedicated parser — standard JSON.parse does not accept them. If your tooling supports JSONC, name the file with a .jsonc extension and use a JSONC parser.