🔧 JSON Tool Pro

Format · Validate · Diff · Java POJO · TypeScript · CSV · Escape · JSONPath

← Back to Blog

10 Common JSON Errors and How to Fix Them

JSON errors are among the most frequent issues developers encounter when working with APIs, configuration files, and data exchange. While the JSON specification is simple, small syntax mistakes can waste hours of debugging time.

Here are the 10 most common JSON errors — and how to fix each one.

1. Trailing Commas

Error: A comma after the last element in an object or array.

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

Fix: Remove the comma after the last item.

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

JavaScript allows trailing commas in object literals, but JSON strictly does not.

2. Single Quotes Instead of Double Quotes

Error: Using single quotes for keys or string values.

{ 'name': 'Alice' }

Fix: Replace all single quotes with double quotes.

{ "name": "Alice" }

This is the most common mistake when copying JavaScript objects into a JSON context.

3. Unquoted Keys

Error: Object keys without surrounding double quotes.

{ name: "Alice" }

Fix: Always wrap keys in double quotes.

{ "name": "Alice" }

4. Missing Comma Between Items

Error: Missing commas between properties or array elements.

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

Fix: Add a comma after each property (except the last).

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

5. Extra Comma Between Items

Error: A comma in the wrong place, like before a closing bracket.

[1, 2, 3,]

Fix: Remove the comma before the closing bracket.

[1, 2, 3]

6. Missing Closing Bracket or Brace

Error: Unmatched opening braces or brackets without corresponding closing ones.

{ "items": [1, 2, 3

Fix: Ensure every opening { has a closing }, and every [ has a ].

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

7. Using Comments

Error: JSON does not support comments — not even // or /* */.

{ "name": "Alice" /* user's name */ }

Fix: Remove all comments from your JSON data.

{ "name": "Alice" }

If you need to add notes, consider using a _comment key in your object instead.

8. Using True/False/None (Python Style)

Error: Using Python's boolean or null values instead of JavaScript JSON equivalents.

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

Fix: Use lowercase true, false, and null.

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

9. Undefined Values

Error: Using JavaScript's undefined in JSON data.

{ "name": undefined }

Fix: Use null instead of undefined.

{ "name": null }

Unlike JavaScript, JSON does not have an undefined type.

10. Invalid Number Formats

Error: Numbers with leading zeros, hex values, or special number formats.

{ "value": 0123, "hex": 0xFF }

Fix: Remove leading zeros and use only decimal numbers.

{ "value": 123 }

Quick Fix: Use Our JSON Repair Tool

Instead of manually hunting for each error, paste your broken JSON into our JSON Repair Tool. It automatically fixes all 10 errors listed above — single quotes, trailing commas, unquoted keys, comments, and more.

🔧 Open JSON Repair Tool →