Expected ',' or '}' after property value in JSON
The parser finished reading a value inside an object and then found something that was neither the comma before the next key nor the brace that closes the object. The position points at that unexpected thing. The actual mistake is usually just before it, often at the end of the previous line.
Input
{"id": 7
"name": "Ada"}Do
- Paste the input into the validator.
- Press Repair in the editor band.
Result
Inserted missing commas
{"id": 7,
"name": "Ada"}| Runtime | Message |
|---|---|
| Chrome 153 · Node.js 26 | Expected ',' or '}' after property value in JSON at position 10 (line 2 column 2) |
| Node.js 18 (older V8) | Unexpected string in JSON at position 10 |
| Firefox 156 | JSON.parse: expected ',' or '}' after property value in object at line 2 column 2 of the JSON data |
| Safari 26 | JSON Parse error: Expected '}' |
| Python 3.14 json | Expecting ',' delimiter: line 2 column 2 (char 10) |
| This site | Expected "," or "}", found """line 2, column 2 |
Recorded from each runtime; the wording is in Firefox’s, Safari’s and Python’s sources.
Reading the position
Current Chrome and Node.js give two numbers. Position 10 counts characters from the start of the text, beginning at zero, and the part in brackets turns that into a line and a column counted from one. Here it is line 2, column 2: the opening quote of "name". The parser only knew something was wrong once it met that quote, so that is where it points, but the comma belongs after the 7 on line 1. When an error lands at the start of a line, look at the end of the line above it first. Python counts the same way, with its char figure starting at zero and its column at one.
What else produces it
- A comment.
// primary keyafter a value gives this exact message, pointing at the slash. JSON has no comments; configuration formats that allow them, such as JSONC, are separate dialects. - An unescaped quote inside a string. In
"say "hi""the second quote closes the string early, and the parser then trips overhi. Inside a string, a double quote must be written\". - A missing closing quote earlier in the object, which makes the parser read the text up to the next quote as one string and then complain about what follows.
- Two values where one belongs, such as
"size": 1 2left by a hand edit or a template that printed a field twice. - A cut-off document that stops after a complete value, as in
{"id": 7. Current V8 reports the missing comma or brace there; older versions called it an unexpected end of JSON input.
Arrays have a twin: Expected ',' or ']' after array element means the same thing between the items of a list, including a list that was cut off after its last complete item.
The other runtimes
Firefox adds in object to the phrase and reports the position as a line and column. Python calls it an expected comma delimiter. Safari says only that it expected a closing brace, which is technically true and rarely helpful, since the comma is what is missing. Node.js 18 named the kind of token it found instead: Unexpected string when the next thing was a key, or Unexpected token followed by the character.
Fixing it
A diff of the last change to the file usually shows the line where a comma was dropped. For a larger document, paste it into the JSON Validator: Code view underlines the token after the gap and the status bar reads Invalid JSON until the object is whole again.
Repair inserts every missing comma in one pass, removes comments, and turns a run of separate top-level values into an array. Two of the causes above are a different matter, because the text no longer says what was meant. Repair still makes them parse, but by guessing: "size": 1 2 comes out as a second key named "2" with a null value, and the quoted word in "say "hi"" becomes a key of its own. Both results are valid and both are wrong, so read the list of fixes, and when it mentions quoted property names or a filled-in value you did not expect, undo and correct that line by hand. The guide to fixing invalid JSON explains how to read that list.