JSON property names must be quoted
Why {name: 1} is invalid JSON while {"name": 1} is valid, and how to fix a document whose keys are unquoted.
Open the JSON formatterWhat the error looks like
Different engines word this differently. You may see any of these:
Why it happens
- JavaScript allows an unquoted identifier as an object key, so hand-written or copied-from-code objects often omit the quotes.
- JSON requires every property name to be a double-quoted string, without exception, including names that would be valid identifiers.
- The output of console.log on an object is not JSON, and pasting it is the most common way to hit this.
Example
{
name: "My Mosaic",
version: 2
}
{
"name": "My Mosaic",
"version": 2
}
How this tool reports it
The formatter reports each unquoted name separately and offers to add the quotes, escaping the name properly if it contains characters that need it.
Paste your JSON into the formatter to see the exact line and column, or use the validator if you only need to check it.