Missing comma in JSON: "Expected ',' or '}' after property value"
How to find the missing comma between two JSON items, with the exact error messages from Chrome, Node.js and Python.
Error messages you may see
| Chrome · Edge · Node.js | SyntaxError: Expected ',' or '}' after property value in JSON at position 20 (line 3 column 3) |
|---|---|
| Older Chrome · Node.js 18 and earlier | SyntaxError: Unexpected string in JSON at position 20 |
| Python json.loads | json.decoder.JSONDecodeError: Expecting ',' delimiter: line 3 column 3 (char 20) |
| This tool | Line 3, Col 3: Expected ',' or '}' but found '"' |
Why it happens
Each item in an object or array must be separated by a comma. It is easy to forget one when adding a new line at the end or merging two pieces of JSON.
Invalid
{
"name": "Kim"
"age": 30
}
How to fix
Look at the line the error points to: the comma is missing at the end of the item just before it. Add it there. The formatter shows the exact line and column.
Fixed
{
"name": "Kim",
"age": 30
}