Quick answer
In JSON, every object key must be a double-quoted string.
JSON Unquoted Keys
In JSON, every object key must be a double-quoted string. Unquoted or single-quoted keys are invalid.
Common causes
- Writing JSON by hand and omitting quotes around keys.
- Copying JavaScript object literals (which allow unquoted keys).
- Using single quotes instead of double quotes.
How to fix
- Put double quotes around every key: "key": value.
- Replace single quotes with double quotes for keys and strings.
- Use a JSON formatter or validator to spot unquoted keys.
Examples
Bad
{ name: "test" }Good
{ "name": "test" }JSON unquoted keys errors happen when an object uses keys without double quotes, or when single quotes are used instead of valid JSON string syntax. This validator page helps developers, API consumers, and QA teams identify why a payload fails to parse and how to correct it before it breaks integrations, configuration loading, or data exchange. JSON is strict by design, so even small syntax differences can cause a parser to reject the entire document. Use this page to understand the rule, spot common formatting mistakes, and produce valid JSON that works reliably across browsers, servers, databases, and APIs.
How This Validator Works
This checker focuses on a core JSON syntax rule: object property names must be double-quoted strings. A valid JSON object uses the pattern "key": "value", not key: "value" and not 'key': 'value'. When a parser encounters an unquoted key, it typically stops reading the document and returns a syntax error. The validator helps you identify the exact structure that is invalid so you can correct the payload before sending it to an API, storing it in a config file, or using it in a frontend application.
- Detects object keys that are not wrapped in double quotes
- Flags single-quoted keys, which are valid in JavaScript objects but not in JSON
- Helps distinguish JSON syntax from JavaScript object literal syntax
- Supports debugging of API requests, configuration files, and data exports
Common Validation Errors
Unquoted key errors usually appear alongside other JSON syntax issues. In practice, the parser may report the first invalid token it finds, even if more than one problem exists in the document.
- Unquoted property names:
{ name: "Ada" } - Single-quoted keys:
{ 'name': "Ada" } - Mixed JSON and JavaScript syntax: object literals copied into a JSON field
- Trailing commas: often appear in the same payload and cause separate parse failures
- Incorrect escaping: malformed strings can make a key look invalid to the parser
To fix the issue, convert every key to a double-quoted JSON string and ensure the entire object follows JSON syntax rules.
Where This Validator Is Commonly Used
JSON syntax validation is used anywhere structured data is exchanged or stored. Teams rely on it to prevent broken requests and invalid configuration from reaching production systems.
- REST and GraphQL API request bodies
- Frontend applications consuming JSON responses
- Configuration files and environment-driven settings
- Webhook payloads and event messages
- Data pipelines, ETL jobs, and import/export workflows
- Documentation examples and developer tooling
Why Validation Matters
JSON is a strict interchange format, which makes it predictable across languages and platforms. That strictness is useful because it reduces ambiguity, but it also means syntax mistakes can break parsing immediately. Validating JSON before use helps prevent failed API calls, corrupted configuration loads, and hard-to-debug runtime errors. It also improves developer experience by catching issues early, before they affect downstream systems or users.
Technical Details
According to the JSON data format defined in RFC 8259, object member names must be strings enclosed in double quotes. Unlike JavaScript object literals, JSON does not allow bare identifiers, single-quoted strings, comments, or trailing commas. A compliant parser expects a sequence like { "id": 123 }. If it sees { id: 123 }, the document is invalid JSON and should be corrected before parsing.
| Rule | Valid JSON | Invalid JSON |
|---|---|---|
| Object keys | "name" |
name, 'name' |
| String values | "value" |
'value' |
| Object syntax | { "name": "Ada" } |
{ name: "Ada" } |
FAQ
Why are unquoted keys invalid in JSON?
JSON uses a strict grammar where every object member name must be a double-quoted string. This rule keeps the format consistent across programming languages and parsers. Bare identifiers are allowed in JavaScript object literals, but JSON is a separate data format with narrower syntax rules.
Can I use single quotes for JSON keys?
No. Single quotes are not valid for JSON keys or string values. If you need valid JSON, convert all single-quoted strings to double-quoted strings. Some tools accept JavaScript-like input, but that is not standard JSON and may fail in APIs or parsers that enforce the specification.
What is the difference between JSON and a JavaScript object?
A JavaScript object literal can use unquoted keys in many cases, while JSON cannot. JSON is a text-based interchange format with stricter syntax. If you copy an object from code into a JSON field, you may need to add double quotes around every key and string value.
How do I fix an unquoted key error quickly?
Wrap each property name in double quotes and make sure the rest of the document follows JSON rules. For example, change { user: "sam" } to { "user": "sam" }. Then revalidate the payload to confirm there are no other syntax issues such as trailing commas or invalid escape sequences.
Can unquoted keys appear in API requests?
Yes, but only if the request body is not being treated as strict JSON. Many APIs expect application/json and will reject unquoted keys immediately. If a request fails, check whether the payload is actually JSON or a JavaScript object being sent in the wrong format.
Why does the parser stop at the first error?
Most JSON parsers report the first syntax problem they encounter because the document cannot be reliably interpreted after that point. An unquoted key often prevents the parser from continuing, even if other issues are present later in the payload. Fix the first error, then validate again.
Are comments allowed in JSON?
No. Standard JSON does not allow comments, unquoted keys, trailing commas, or single quotes. Some developer tools support relaxed JSON variants, but those are not compliant with RFC 8259. If compatibility matters, use strict JSON syntax.
What tools commonly produce this error?
This error often appears in API clients, config editors, code generators, and copy-pasted examples from JavaScript. It can also occur when a human edits JSON manually and uses a syntax style borrowed from programming languages rather than the JSON specification.
Related Validators & Checkers
FAQ
- Can JSON keys be unquoted?
- No. The JSON spec requires keys to be double-quoted strings.
- Why does JavaScript allow unquoted keys but JSON does not?
- JSON is a data format meant to be strict and portable; JavaScript is a language with looser syntax.
Fix it now
Try in validator (prefill this example)