JSON's syntax rules are strict and unforgiving - a single stray comma or the wrong quote character will fail the entire document. Here are the mistakes that come up most often, each with a broken example and the fix.

1. Trailing Commas

Unlike JavaScript object literals, JSON does not allow a comma after the last item.

✗ Invalid

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

✓ Valid

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

2. Single Quotes Instead of Double Quotes

JSON strings and keys must use double quotes - single quotes are not valid JSON, even though they work fine in JavaScript.

✗ Invalid

{'name': 'Alice'}

✓ Valid

{"name": "Alice"}

3. Unquoted Keys

Every key must be a double-quoted string. Bare, unquoted keys are valid JavaScript object syntax but not valid JSON.

✗ Invalid

{name: "Alice"}

✓ Valid

{"name": "Alice"}

4. Missing Commas Between Properties

Every property except the last one needs a comma after it.

✗ Invalid

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

✓ Valid

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

5. Using undefined or NaN

JSON only supports strings, numbers, objects, arrays, booleans and null. JavaScript-only values like undefined, NaN and Infinity have no JSON equivalent and are not valid.

✗ Invalid

{"age": undefined}

✓ Valid

{"age": null}

6. Comments

JSON has no comment syntax at all - not //, not /* */. Any comment will cause a parse error.

✗ Invalid

{
  "name": "Alice" // the user's name
}

✓ Valid

{
  "name": "Alice"
}

7. Mismatched or Missing Brackets

Every { needs a matching }, and every [ needs a matching ]. This is the most common error in large, deeply nested documents - easy to miss by eye, easy to catch with a formatter.

✗ Invalid

{
  "tags": ["json", "api"
}

✓ Valid

{
  "tags": ["json", "api"]
}

8. Duplicate Keys

Technically, the JSON spec doesn't forbid duplicate keys in an object - but it doesn't define what should happen either. Most parsers silently keep only the last occurrence, which can hide a real bug rather than raise an error.

{
  "status": "pending",
  "status": "complete"
}
// most parsers only keep "status": "complete"

Find and Fix Errors Automatically

Paste your JSON and get an instant, precise error location instead of hunting by eye.

Open JSON Formatter →