Single Quotes in JSON: Strings Need Double Quotes

Correct single-quoted JSON names and strings while preserving apostrophes and escaped quotes inside the data.

JSON strings and object property names use double quotes. A JavaScript object literal using single quotes may run as code, but it is not valid JSON text.

Correct the delimiters

Invalid:

{'name': 'Alex', 'active': true}

Valid:

{ "name": "Alex", "active": true }

Only string delimiters change here. The boolean true remains unquoted; "true" would be a different value type.

Preserve apostrophes within strings

{ "message": "Alex's project is ready" }

This is already valid. A global replacement of apostrophes with double quotes would corrupt it. Fix the surrounding delimiters intentionally, then escape any embedded double quotes as needed:

{ "message": "Alex said \"ready\"" }

Backslashes also need attention

An apostrophe does not need escaping inside a JSON string. The escape \' is not a valid JSON escape. For literal backslashes, use \\; for an embedded newline, use \n. Read the syntax guide for the distinction between characters in the data and their written representation.

Prefer serialization at the source

When you control the producer, use the language’s JSON serializer instead of constructing JSON through string concatenation. This avoids many quoting and escaping errors. Check that the receiving application expects strict JSON rather than another format such as JSON5.

The validator can show where strict parsing fails. Its suggestions explain likely fixes; it does not automatically replace quote characters. See RFC 8259, strings for the grammar.

Already have valid JSON? Make it readable