Single Quotes Error
Back to Tools
SyntaxError: Unexpected token ' in JSON at position...
While JavaScript and Python allow defining strings and dictionary keys with single quotes ('), the JSON standard requires strict double quotes (") for all keys and string values.
Common Causes
- •Printing a Python dictionary directly to string via `str()` instead of using `json.dumps()`.
- •Applying standard JavaScript object formatting to a JSON payload.
- •Using LLMs that accidentally output Python-style dictionaries instead of valid JSON.
What Triggers It
{
'username': 'johndoe',
'active': true
}How to Fix It
{
"username": "johndoe",
"active": true
}The Solution
Replace all single quotes with double quotes. If the string itself contains double quotes, you must escape them (e.g. `\"text\"`). Our JSON beautifier can automatically convert Python-style single quotes to strict JSON double quotes.
Fix Your JSON Automatically
Paste your broken JSON code into our free online tool to repair syntax errors instantly.