Developer Guide
How to fix common JSON syntax errors
Troubleshooting RFC 8259 compliance & parser exceptions
1. Trailing commas in arrays and objects
Standard JSON strictly forbids trailing commas before closing braces (}) or brackets (]). While modern JavaScript permits them, standard JSON parsers will throw SyntaxError: Unexpected token.
// ❌ Invalid JSON (Trailing commas)
{
"status": "success",
"data": [10, 20, 30, ],
}
// ✅ Correct JSON
{
"status": "success",
"data": [10, 20, 30]
}
2. Single quotes instead of double quotes
JSON string values and object keys must always use double quotes ("). Single quotes (') or backticks (`) are invalid in JSON.
// ❌ Invalid JSON
{ 'username': 'ada_lovelace' }
// ✅ Correct JSON
{ "username": "ada_lovelace" }
3. Unquoted object keys
In JavaScript object literals, identifiers like name: "Ada" are legal. In JSON, every object key must be wrapped in double quotes.
// ❌ Invalid JSON
{ id: 101, name: "Ada" }
// ✅ Correct JSON
{ "id": 101, "name": "Ada" }
4. Comments in JSON files
Standard JSON does not allow single-line (//) or multi-line (/* ... */) comments. Strip all comments before parsing or use JSONC only in environments that explicitly support it (like VS Code settings).
5. Python booleans and None values
Python outputs True, False, and None. In standard JSON, these must be lowercase: true, false, and null.
Instant 1-Click Auto Repair
Paste any broken payload into JSONLints Studio and click Auto Repair. JSONLints automatically fixes unquoted keys, single quotes, trailing commas, comments, and Python literals directly in your browser without uploading data.