Convert Single Quotes to Double Quotes in JSON

A Python dict is already in the editor. Auto-Fix turns single-quoted strings into JSON strings and maps True, False, and None to true, false, and null. Nothing is uploaded.

Input

Size
0 B
Lines
0
Keys
0
Depth
0

Python dicts and JavaScript objects are not JSON

JSON strings use double quotes. Python and a lot of JavaScript snippets use single quotes, and Python writes True, False, and None instead of true, false, and null. JSON.parse rejects all of that. Auto-Fix rewrites those forms in this browser, then parses the result.

Single-quoted strings

Before: {'name': 'Ada Lovelace'}. After Auto-Fix: {"name": "Ada Lovelace"}. An apostrophe inside a single-quoted string is kept, and quotes inside the value are escaped the way JSON.stringify escapes them.

Python literals

Before: {'active': True, 'score': None}. After Auto-Fix: {"active": true, "score": null}. False becomes false. A trailing comma after the last item is removed in the same pass. A word that is already inside a double-quoted string is not changed.

Valid JSON is left as JSON. Beautify still reports a line and column when the text cannot be repaired. Quote problems that are really an HTML error page belong on Fix JSON.parse unexpected token.

Frequently Asked Questions

Why do single quotes fail in JSON?

RFC 8259 strings start and end with a double quote. A single-quoted string is valid in Python and JavaScript, and JSON.parse rejects it.

Can this convert a Python dict?

Yes. The preloaded sample is a Python dict. Auto-Fix quotes its strings with double quotes, converts True, False, and None, and removes a trailing comma.

What happens to True, False, and None?

Outside a string, True becomes true, False becomes false, and None becomes null. The same words inside a quoted string stay text.

Does the conversion upload my text?

No. Pasted text and a local .json file stay in this browser. The repaired JSON is written to the result box on this page.

Are single quotes inside a double-quoted string changed?

No. Auto-Fix only rewrites a string that is itself wrapped in single quotes. Characters inside an existing double-quoted JSON string stay as they are.