JSON strings must use double quotes
JSON has no single-quoted string form. Property names and string values both require double quotes. Here is why, and how to convert safely.
Open the JSON formatterWhat the error looks like
Different engines word this differently. You may see any of these:
Why it happens
- Python dictionaries, JavaScript literals and most languages' debug output use single quotes, so text that looks like JSON often is not.
- The JSON grammar defines exactly one string form, delimited by double quotes. There is no alternative spelling.
- Printing a Python dict with print() produces single quotes; json.dumps() produces valid JSON. Mixing the two is the usual source of this error.
Example
{
'name': 'My Mosaic',
'version': 2
}
{
"name": "My Mosaic",
"version": 2
}
How this tool reports it
The formatter converts single-quoted strings to valid double-quoted ones, re-escaping the contents so a value that already contains a double quote survives the conversion.
Paste your JSON into the formatter to see the exact line and column, or use the validator if you only need to check it.
Worth knowing
- Do not convert with find and replace. A string containing an apostrophe or an embedded double quote will break, which is exactly the case a careless replacement gets wrong.