Unexpected string in JSON

Expected ':' after property name in JSON at position 5 (line 1 column 6)
(the exact message depends on context; other forms: "Expected ',' or ']'", "Expected ',' or '}'")

The "unexpected string" family of errors fires when the parser encounters a quoted string in a position where it is not syntactically allowed. The most common triggers are a missing comma between object properties, a missing colon between a key and its value, or a stray string at the top level. The engine reports what it expected rather than what the problem is, so the message may say "Expected ':'" or "Expected ','" depending on exactly where the extra or missing character falls.

Missing colon between key and value

Every object entry in JSON must have the form "key": value. If you omit the colon, the parser sees the value string immediately after the key string and reports an error.

Invalid

{"name" "Alice"}

Valid

{"name": "Alice"}

Missing comma between properties

Adjacent properties in an object must be separated by a comma. Omitting the comma causes the parser to find a second property key string where it expected ',' or '}'.

Invalid

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

Valid

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

Duplicate comma (double comma)

Two commas in a row, often introduced by a cut-paste operation, create an empty element slot. The parser expects a value but finds another comma or a closing bracket.

Invalid

{"a": 1,, "b": 2}

Valid

{"a": 1, "b": 2}

Unquoted property name

In JSON, all keys must be quoted strings. An unquoted identifier is valid JavaScript but illegal JSON.

Invalid

{name: "Alice"}

Valid

{"name": "Alice"}

Fix this error in seconds

Paste your JSON in the free validator to find the exact line and column where the error occurs.

Open JSON Validator →

Frequently Asked Questions

How do I find exactly which line has the missing comma?

The error position (line N column M) points to where the parser detected the problem, which is usually one token after the actual mistake. For a missing comma, look at the line above the reported position. Use the JSONSmith validator — it highlights the exact location and shows the surrounding context.

Does JavaScript's JSON.parse give a line number?

Modern V8 (Node 20+) includes a line and column number in the error message, e.g. "at position 42 (line 3 column 7)". Older engines only give a byte offset. If you are on an older environment, count characters manually or paste into a validator that normalizes line breaks first.

More JSON errors