Identify, understand, and fix the most frequent JSON syntax errors with side-by-side code corrections.
In modern JavaScript and languages like Python or Swift, trailing commas after the last array item or object property are allowed. In standard JSON (RFC 8259), trailing commas are strictly forbidden.
{
"name": "Varun",
"skills": ["Swift", "React",],
"age": 28,
}{
"name": "Varun",
"skills": ["Swift", "React"],
"age": 28
}JSON specifications strictly require double quotes (") for all strings and object keys. Single quotes (') will cause an immediate syntax error.
{
'name': 'Alex',
'city': 'San Francisco'
}{
"name": "Alex",
"city": "San Francisco"
}In JavaScript code, object keys often do not need quotes (e.g. { name: "Jane" }). In JSON, every object key must be double-quoted.
{
name: "Jane",
age: 30
}{
"name": "Jane",
"age": 30
}When an array [ ... ] or object { ... } is not closed properly, JSON engines report an error such as:
“Expected ',' or ']' after array element”
This happens because the parser reaches the outer closing brace } before the inner array was closed with ].
{
"name": "Varun",
"skills": [
"Swift",
"SwiftUI"
}{
"name": "Varun",
"skills": [
"Swift",
"SwiftUI"
]
}The JSON standard deliberately omits support for comments (like // or /* */) to prevent parsing fragmentation. If you need configuration with comments, consider YAML or JSON5, or convert to JSON with our YAML to JSON Converter.
{
// User profile information
"username": "coder2026",
/* Status flag */
"active": true
}{
"username": "coder2026",
"active": true
}JSON only accepts string, number, boolean, null, array, and object. Values like undefined, NaN, Infinity, or functions will fail to parse.
Paste your JSON into our free, privacy-first tools: