Guides / JSON errors
“Expected ',' or '}' after property value in JSON”
How it appears per engine
- Uncaught SyntaxError: Expected ',' or '}' after property value in JSON at position 27 (Chrome / Node.js)
- SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 3 column 3 of the JSON data (Firefox)
What this error means
After a property value, only two characters can follow: a comma (more properties coming) or a closing brace (object ends). The parser found something else — which nearly always means a missing comma on the line above, or a value that needed quotes.
Common causes
1. Missing comma between properties
The error points at the start of the NEXT property, but the actual mistake is the missing comma at the end of the previous line.
Fails
{
"a": 1
"b": 2
}Works
{
"a": 1,
"b": 2
}2. An unquoted string value
A bare word after the colon parses as far as it can, then fails. Strings must be double-quoted; only numbers, true, false, null, objects, and arrays may appear bare.
Fails
{ "status": active }Works
{ "status": "active" }3. Concatenation gone wrong
Hand-building JSON with string concatenation or templates easily drops a comma or a quote. Build the object in code and JSON.stringify it instead.
How to fix it
- Look one line ABOVE the reported line/column — that is where the comma is missing.
- Quote every string value with double quotes.
- Never assemble JSON by hand in strings; use JSON.stringify.