Fix invalid JSON: common errors and solutions
Identify and fix the most common JSON errors: missing commas, single quotes, unquoted keys and comments.
Published on January 10, 2026Invalid JSON is one of the most frustrating sources of errors in development. A trailing comma, single quotes instead of double quotes, an unquoted key: every violation of the JSON standard completely blocks the interpreter. An online JSON formatter detects these errors instantly.
Understanding the conversion
The JSON standard (RFC 8259) is very strict: keys and string values must be in double quotes, objects and arrays must not have trailing commas (after the last element), comments are not allowed and values can only be string, number, boolean, null, object or array. Using an online correction tool allows you to identify the exact line and column of the error and understand its nature.
📊 Conversion table
| Error | Invalid JSON | Fixed JSON |
|---|---|---|
| Single quotes | {'name': 'Alice'} | {"name": "Alice"} |
| Trailing comma | {"a": 1,} | {"a": 1} |
| Unquoted key | {name: "Alice"} | {"name": "Alice"} |
| Comment | {"a": 1 // comment} | {"a": 1} |
| Undefined value | {"a": undefined} | {"a": null} |
💡 Practical examples
This error indicates single quotes. Replace all ' with " around key and string values. The ToolSmartly formatter does this automatically.
A comma after the last element of an array or object. Ex: [1, 2, 3,] → [1, 2, 3]. Remove the trailing comma.
JS code often uses unquoted keys and undefined values or functions. These elements must be removed or replaced before obtaining valid JSON.