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
Single quotes instead of double quotes
Broken JSON:
{'name': 'John'}Fixed JSON:
{"name": "John"}Trailing comma
Broken JSON:
{"name": "John", "age": 30,}Fixed JSON:
{"name": "John", "age": 30}Unquoted key
Broken JSON:
{name: "John"}Fixed JSON:
{"name": "John"}Missing comma
Broken JSON:
{"name": "John" "age": 30}Fixed JSON:
{"name": "John", "age": 30}Missing closing brace
Broken JSON:
{"users": [{"name": "John"}]Fixed JSON:
{"users": [{"name": "John"}]}Unescaped quotes
Broken JSON:
{"message": "He said "Hello""}Fixed JSON:
{"message": "He said \"Hello\""}Comments in JSON
Broken JSON:
{// comment
"name": "John"}Fixed JSON:
{"name": "John"}NaN value
Broken JSON:
{"price": NaN}Fixed JSON:
{"price": null}Infinity value
Broken JSON:
{"count": Infinity}Fixed JSON:
{"count": null}undefined value
Broken JSON:
{"middleName": undefined}Fixed JSON:
{"middleName": null}Trailing comma in array
Broken JSON:
[1, 2, 3,]
Fixed JSON:
[1, 2, 3]
Date object
Broken JSON:
{"date": new Date()}Fixed JSON:
{"date": "2025-01-15T00:00:00.000Z"}Multiple root objects
Broken JSON:
{"a": 1}{"b": 2}Fixed JSON:
[{"a": 1}, {"b": 2}]Octal number
Broken JSON:
{"code": 0123}Fixed JSON:
{"code": 123}Unescaped newline
Broken JSON:
{"message": "Line 1
Line 2"}Fixed JSON:
{"message": "Line 1\nLine 2"}Double comma
Broken JSON:
{"name": "John",, "age": 30}Fixed JSON:
{"name": "John", "age": 30}Missing closing bracket
Broken JSON:
{"items": [1, 2, 3}Fixed JSON:
{"items": [1, 2, 3]}Missing closing brace in nested object
Broken JSON:
{"nested": {"key": "value"}Fixed JSON:
{"nested": {"key": "value"}}Trailing comma in array
Broken JSON:
{"tags": ["red", "blue",]Fixed JSON:
{"tags": ["red", "blue"]}Missing comma between values
Broken JSON:
{"value": true false}Fixed JSON:
{"value": true, "other": false}Missing comma and quotes
Broken JSON:
{"name": "John" age: 30}Fixed JSON:
{"name": "John", "age": 30}Unescaped newline in string
Broken JSON:
{"text": "Hello
World"}Fixed JSON:
{"text": "Hello\nWorld"}Actually valid - empty object
Broken JSON:
{"data": {}}Fixed JSON:
{"data": {}}Missing closing bracket
Broken JSON:
{"list": [1, 2, 3, 4, 5}Fixed JSON:
{"list": [1, 2, 3, 4, 5]}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.