← Back to Blog
Tutorial6 min read

10 Common JSON Mistakes and How to Fix Them

Published on January 28, 2026

JSON might seem simple, but even experienced developers make syntax mistakes that can break their applications. Here are the 10 most common JSON errors and how to fix them.

1. Using Single Quotes Instead of Double Quotes

JSON strictly requires double quotes for strings. Single quotes are not valid.

❌ Wrong

{'name': 'John'}

✓ Correct

{"name": "John"}

2. Trailing Commas

Unlike JavaScript, JSON does not allow trailing commas after the last element.

❌ Wrong

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

✓ Correct

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

3. Unquoted Property Names

All property names (keys) in JSON must be enclosed in double quotes.

❌ Wrong

{name: "John"}

✓ Correct

{"name": "John"}

4. Using Comments

JSON does not support comments. Remove all // and /* */ comments from your JSON.

❌ Wrong

{"name": "John" // user name}

✓ Correct

{"name": "John"}

5. Using undefined

JSON doesn't have an undefined type. Use null instead.

❌ Wrong

{"value": undefined}

✓ Correct

{"value": null}

6. Incorrect Boolean Values

Boolean values must be lowercase: true and false, not True, False, TRUE, or FALSE.

7. Missing Commas Between Elements

Every element in an array or object must be separated by a comma.

8. Using NaN or Infinity

JSON doesn't support special number values like NaN or Infinity. Use null or a string representation instead.

9. Forgetting to Escape Special Characters

Characters like backslashes, quotes, and newlines inside strings must be escaped.

{"path": "C:\\Users\\Documents"}

10. Using Hexadecimal Numbers

JSON only supports decimal numbers. Hexadecimal (0xFF) and octal (0777) are not valid.

How to Avoid These Mistakes

The easiest way to catch JSON errors is to use a JSON validator or formatter tool. Our free JSON Formatter can help you identify and fix these common mistakes instantly!

Try Our JSON Formatter

Format, validate, and minify your JSON data instantly - no sign-up required!

Open JSON Formatter
simple json formatter