</>
ValidateHTML

Single Quotes in JSON

JSON requires all strings and property names to be wrapped in double quotes. Single quotes, backticks, or unquoted strings are not valid JSON. This rule exists because JSON is a strict data interchange format, not a programming language.

Why It Matters

Any JSON with single quotes will fail to parse in every standard JSON parser. APIs reject the payload, configuration files fail to load, and data exchanges break.

Common Causes

  • Writing JSON by hand with the single-quote habit carried over from JavaScript or Python.
  • Using Python's print() or str() on a dict, which emits single quotes, then saving the result as JSON.
  • Pasting a string that uses curly typographic quotes from a word processor instead of straight double quotes.

Code Examples

Invalid JSON
{
  'name': 'John',
  'city': 'New York',
  'active': true
}
Valid JSON
{
  "name": "John",
  "city": "New York",
  "active": true
}

How to Fix

  • 1Replace all single quotes with double quotes for both keys and string values.
  • 2If your string contains double quotes, escape them with a backslash: \".
  • 3Do not use backticks or template literals. They are not valid in JSON.
  • 4Use a find-and-replace to quickly swap single quotes to double quotes in your editor.

Frequently Asked Questions

Why does JSON only allow double quotes?
RFC 8259 defines a JSON string as characters wrapped in double quotes. Allowing a single quote style keeps the grammar unambiguous and identical across every language, which is the whole point of an interchange format.
How do I include a double quote inside a JSON string?
Escape it with a backslash: "She said \"hi\"". The backslash tells the parser the quote is literal text, not the end of the string.
Are smart or curly quotes valid in JSON?
No. Only the straight ASCII double quote character is a valid string delimiter. Curly quotes pasted from documents cause a parse error and must be replaced with straight double quotes.

Check Your JSON Now

Our JSON validator detects this error automatically and shows the exact line and column.

Open JSON Validator
Recommended

Cloudways · Managed Cloud Hosting

Fix this JSON error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).

Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303

Start free trial

Related JSON Errors

View all JSON errors