Common JSON errors and how to fix them

The fastest way to debug JSON: know the common mistakes (and what “line/column” errors mean).

• 3 min read

1) Trailing commas

JSON does not allow a comma after the last item in an object or array.

{
  "a": 1,
}

Fix: remove the last comma.

2) Single quotes

JSON strings must use double quotes, not single quotes.

{ 'name': 'Ada' }

Fix:

{ "name": "Ada" }

3) Unquoted keys

In JSON, object keys must be quoted.

{ name: "Ada" }

Fix:

{ "name": "Ada" }

4) Missing brackets/braces

Every { needs a } and every [ needs a ].

Quick tip

If you see an error like “Unexpected token … at position N”, try formatting the JSON first — it makes the mistake easier to spot.