JSONHack
Validator · Formatter · Base64
Troubleshooting Guide

Common JSON Errors and How to Fix Them

📅Last updated:

JSON is simple, but even a single character out of place makes it completely invalid. APIs fail, apps crash, and data pipelines break — all because of tiny JSON syntax errors. This guide covers the most common JSON mistakes and how to fix them quickly using a JSON validator or JSON formatter.

1. Missing Comma Between Key-Value Pairs

The most frequent JSON error. Every key-value pair must be separated by a comma — except the last one.

❌ Invalid:

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

✅ Fixed:

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

2. Using Single Quotes Instead of Double Quotes

JSON strictly requires double quotes for both keys and string values. Single quotes are not valid JSON.

❌ Invalid:

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

✅ Fixed:

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

3. Trailing Comma After the Last Item

Unlike JavaScript, JSON does not allow a trailing comma after the last element in an object or array.

❌ Invalid:

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

✅ Fixed:

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

4. Unquoted Keys

All JSON keys must be strings enclosed in double quotes. Unquoted keys are valid in JavaScript objects but not in JSON.

❌ Invalid:

{name: "Alice", age: 30}

✅ Fixed:

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

5. Missing Opening or Closing Brace/Bracket

Every { must have a matching }, and every [ must have a matching ].

❌ Invalid:

{"name": "Alice", "skills": ["JS", "Python"

✅ Fixed:

{"name": "Alice", "skills": ["JS", "Python"]}

6. Comments in JSON

JSON does not support comments. Adding // or /* */ comments will make the JSON invalid.

❌ Invalid:

{
  // This is the user object
  "name": "Alice"
}

✅ Fixed: Remove all comments from JSON.

7. Incorrect Boolean or Null Values

JSON booleans and null must be lowercase. True, False, and Null (capitalized) are not valid.

❌ Invalid:

{"active": True, "data": Null}

✅ Fixed:

{"active": true, "data": null}

8. Undefined Values

undefined is a JavaScript concept and is not a valid JSON value. Use null instead.

❌ Invalid:

{"value": undefined}

✅ Fixed:

{"value": null}

9. Special Characters in Strings

Certain characters inside JSON strings must be escaped with a backslash: \", \\, \/, \n, \t, \r.

❌ Invalid:

{"message": "He said "hello""}

✅ Fixed:

{"message": "He said \"hello\""}

How to Fix JSON Errors Instantly

Instead of manually hunting for errors, use JSONHack's free tools:

Best Practices to Avoid JSON Errors

Validate your JSON now

Paste your JSON into JSONHack and find errors in seconds — completely free.

Open JSON Validator →