</>
ValidateHTML

Missing Comma Between Properties

JSON requires a comma between every key-value pair in an object and between every element in an array. A missing comma usually results in an 'expected comma or closing bracket' error. This often happens when adding new properties without remembering to add the separator.

Why It Matters

The JSON parser stops at the exact position where the comma is missing. Everything after that point is unparseable, even if the rest of the JSON is valid.

Common Causes

  • Adding a new property or array element without inserting the comma that separates it from the previous one.
  • Merging two JSON snippets and missing the comma at the seam between them.
  • Hand-editing a multi-line object and overlooking that each pair needs a separator.

Code Examples

Invalid JSON
{
  "name": "John"
  "age": 30
  "city": "Paris"
}
Valid JSON
{
  "name": "John",
  "age": 30,
  "city": "Paris"
}

How to Fix

  • 1Add a comma after every key-value pair except the last one in an object.
  • 2Add a comma after every element except the last one in an array.
  • 3Read the error message carefully. The line number usually points to where the comma is missing.
  • 4Use a JSON formatter to auto-fix comma placement.

Frequently Asked Questions

Where exactly is the missing comma?
The parser reports the position where it expected a comma but found the next value or key instead. The fix is almost always at the end of the line just before the reported position, where a separator is missing.
Do the last property and last array element need a comma?
No. The last member of an object and the last element of an array must not be followed by a comma. A comma goes between two values only, never before a closing brace or bracket.
Why does the error sometimes say expected comma or closing bracket?
After a value, the parser allows only two things: a comma to continue, or the closing } or ]. When it sees a new key or value instead, it reports both valid options because either one would have been correct there.

Check Your JSON Now

Our JSON validator detects this error automatically and shows the exact line and column.

Open JSON Validator
Recommended

Cloudways · Managed Cloud Hosting

Fix this JSON error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).

Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303

Start free trial

Related JSON Errors

View all JSON errors