Unquoted Property Keys in JSON
In JavaScript, object keys don't need quotes if they are valid identifiers. In JSON, every key must be a double-quoted string, no exceptions. This is one of the most common mistakes when converting JavaScript objects to JSON.
Why It Matters
The JSON parser fails at the first unquoted key. This is a frequent source of bugs when developers manually write JSON or copy JavaScript objects into .json files.
Code Examples
{
name: "John",
age: 30,
isActive: true
}{
"name": "John",
"age": 30,
"isActive": true
}How to Fix
- 1Wrap every property name in double quotes.
- 2Use JSON.stringify() in JavaScript to automatically generate valid JSON from an object.
- 3If converting from YAML or another format, ensure keys are quoted in the output.
- 4Configure your editor to highlight JSON syntax errors with a JSON language mode.
Check Your JSON Now
Our JSON validator detects this error automatically and shows the exact line and column.
Open JSON ValidatorHostinger — Fast & Affordable Web Hosting
Deploy clean, validated JSON APIs on reliable hosting.
Related JSON Errors
Single Quotes in JSON
JSON requires double quotes for all strings and keys. Learn how to fix the single quotes error.
Unexpected Token in JSON
Learn why JSON throws an unexpected token error and how to fix it. Common causes include trailing commas, single quotes, and unquoted keys.
Trailing Comma in JSON
How to fix the trailing comma error in JSON. Unlike JavaScript, JSON does not allow a comma after the last element.