Code Beautifier
Expected ',' or '}' after property value in JSON

Fix "Expected ',' or '}' after property value in JSON"

The parser finished a value and found neither a comma nor a closing brace next: a missing comma between properties, a bare word, or a stray character.

Input that triggers it

{
  "name": "Ada"
  "role": "admin"
}
Open JSON to YAML on its own page
Draft saved locally.

Local workspace

Named projects in IndexedDB · Local only — never synced to our servers. Worksp

Open manager

Batch workspace

Format multiple files locally in one run.

Indent:
json
Formatted Outputyaml

What the error means

After a complete "key": value pair inside an object, JSON permits exactly two continuations: a comma, which announces another pair, or a closing brace, which ends the object. Expected ',' or '}' after property value in JSON means the parser finished reading a value and the very next non-whitespace character was neither.

In the example, the value "Ada" is complete at the end of line two. Line three begins with "role". That is a string, not a comma or a brace, so the parser stops and reports the position of the opening quote on line three — one line after the actual mistake, which is the missing comma at the end of line two.

Why it happens

  • A missing comma between properties. Far and away the usual cause. It happens when a property is added by hand at the end of an object and the previous line's comma is forgotten, or when lines are reordered.
  • A bare word after a value. "active": true yes or a stray identifier from an incomplete edit.
  • A value that was meant to be a string but is not quoted, such as "env": production. The parser reads production as an error at the p, but in some engines it first consumes what it can and reports this message at the next token.
  • A comment after a value on the same line.
  • A number followed directly by text, for example "port": 5432px.

How to fix it

  1. Paste the document into the converter above. Note the line the error names, then look at the end of the line before it.
  2. If that line ends with a value and no comma, add the comma. This resolves most cases.
  3. If the reported line contains a bare word or a unit after a number, quote the whole value or remove the extra text.
  4. Convert again. The YAML output makes each property visible on its own line, which confirms nothing merged unexpectedly.

The corrected example:

{
  "name": "Ada",
  "role": "admin"
}

If it still fails

  • The same message can appear when an object is closed with ] instead of } because brackets were mismatched several lines earlier. Match every { to a } and every [ to a ] working outward from the error.
  • If you are assembling JSON with string concatenation in code, this error almost always means a missing , in the template. Use the language's JSON serializer instead of building the text by hand.
  • JSON Repair inserts missing commas between properties automatically when the structure is unambiguous.

Related errors