JSON Missing Comma Error – Cause and Fix

A missing comma is one of the most common JSON syntax errors. The parser error usually reads something like Expected ',' or '}', Expected ',' or ']', or SyntaxError: Unexpected string in JSON at position N. The cause is always the same: two items are placed next to each other without a comma between them.

What the error looks like

Here is a JSON object with a missing comma:

{
  "name": "Alice"
  "age": 30
}

The parser reads "name": "Alice" and then expects either a , (to signal another property follows) or a } (to close the object). Instead it finds "age" — a string — which is not a valid token in that position. The fix is a single comma:

{
  "name": "Alice",
  "age": 30
}

The same error in arrays

Arrays need commas between every element too:

// Invalid — missing comma between "banana" and "cherry"
["apple", "banana" "cherry"]

// Valid
["apple", "banana", "cherry"]

Where to look when the error is hard to spot

In large JSON files the missing comma is easy to miss, especially when properties are on the same line or when the file was generated by a script. A few things to try:

Trailing commas — the opposite mistake

If you have a comma after the last item, that is also invalid JSON (even though JavaScript allows it in object literals and arrays):

// Invalid — trailing comma after "cherry"
["apple", "banana", "cherry",]

// Invalid — trailing comma after last property
{
  "name": "Alice",
  "age": 30,
}

Remove the trailing comma and the parser will accept the document. For a dedicated article on this specific error, see JSON Trailing Comma Error.

Fix it quickly with a validator

The fastest way to find a missing comma in a large JSON document is to paste it into the JSON Validator. The tool reports the exact line and column of the syntax error, and the inline error highlighting makes the missing comma immediately visible.

Once the structure is valid, use the JSON Formatter to pretty-print the document — consistent indentation makes missing commas much easier to spot during manual review.

Related articles