Back to Blog

25 Broken JSON Examples and How to Fix Them

Learn from real mistakes developers make

Learning from broken JSON examples is one of the fastest ways to understand JSON syntax. In this guide, we'll show you 25 real broken JSON examples and how to fix each one.

Each example includes the broken JSON, the fixed version, and an explanation. Use our free JSON Fixer to fix these errors automatically.

25 Broken JSON Examples

1

Single quotes instead of double quotes

Broken JSON:

{'name': 'John'}

Fixed JSON:

{"name": "John"}
2

Trailing comma

Broken JSON:

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

Fixed JSON:

{"name": "John", "age": 30}
3

Unquoted key

Broken JSON:

{name: "John"}

Fixed JSON:

{"name": "John"}
4

Missing comma

Broken JSON:

{"name": "John" "age": 30}

Fixed JSON:

{"name": "John", "age": 30}
5

Missing closing brace

Broken JSON:

{"users": [{"name": "John"}]

Fixed JSON:

{"users": [{"name": "John"}]}
6

Unescaped quotes

Broken JSON:

{"message": "He said "Hello""}

Fixed JSON:

{"message": "He said \"Hello\""}
7

Comments in JSON

Broken JSON:

{// comment
"name": "John"}

Fixed JSON:

{"name": "John"}
8

NaN value

Broken JSON:

{"price": NaN}

Fixed JSON:

{"price": null}
9

Infinity value

Broken JSON:

{"count": Infinity}

Fixed JSON:

{"count": null}
10

undefined value

Broken JSON:

{"middleName": undefined}

Fixed JSON:

{"middleName": null}
11

Trailing comma in array

Broken JSON:

[1, 2, 3,]

Fixed JSON:

[1, 2, 3]
12

Date object

Broken JSON:

{"date": new Date()}

Fixed JSON:

{"date": "2025-01-15T00:00:00.000Z"}
13

Multiple root objects

Broken JSON:

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

Fixed JSON:

[{"a": 1}, {"b": 2}]
14

Octal number

Broken JSON:

{"code": 0123}

Fixed JSON:

{"code": 123}
15

Unescaped newline

Broken JSON:

{"message": "Line 1
Line 2"}

Fixed JSON:

{"message": "Line 1\nLine 2"}
16

Double comma

Broken JSON:

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

Fixed JSON:

{"name": "John", "age": 30}
17

Missing closing bracket

Broken JSON:

{"items": [1, 2, 3}

Fixed JSON:

{"items": [1, 2, 3]}
18

Missing closing brace in nested object

Broken JSON:

{"nested": {"key": "value"}

Fixed JSON:

{"nested": {"key": "value"}}
19

Trailing comma in array

Broken JSON:

{"tags": ["red", "blue",]

Fixed JSON:

{"tags": ["red", "blue"]}
20

Missing comma between values

Broken JSON:

{"value": true false}

Fixed JSON:

{"value": true, "other": false}
21

Missing comma and quotes

Broken JSON:

{"name": "John" age: 30}

Fixed JSON:

{"name": "John", "age": 30}
22

Unescaped newline in string

Broken JSON:

{"text": "Hello
World"}

Fixed JSON:

{"text": "Hello\nWorld"}
23

Actually valid - empty object

Broken JSON:

{"data": {}}

Fixed JSON:

{"data": {}}
24

Missing closing bracket

Broken JSON:

{"list": [1, 2, 3, 4, 5}

Fixed JSON:

{"list": [1, 2, 3, 4, 5]}
25

Unquoted string value

Broken JSON:

{"key": value}

Fixed JSON:

{"key": "value"}

Fix All These Errors Instantly

Don't manually fix broken JSON. Our free JSON Fixer automatically detects and repairs all 25 error types shown above.

Fix Broken JSON Now