JSON WalletPrivacy-first JSON & API workspace

Fix JSON With Single Quotes

All languages ยท JSON error

โ† All tools

Unexpected token ' in JSONSyntaxError: Unexpected token ' in JSON at position NExpecting property name enclosed in double quotes

Opens the editor with a broken example loaded and repaired, entirely in your browser โ€” nothing is uploaded.

What causes it

The JSON specification allows exactly one kind of string delimiter: the double quote ("). Single quotes (') are not valid for keys or values, even though JavaScript and Python happily use them in source code.

Python's parser makes this explicit with Expecting property name enclosed in double quotes. The fix is mechanical: every ' that delimits a key or string becomes a ".

How to fix it

  1. Replace the single quotes around every key and string value with double quotes.
  2. Be careful with apostrophes inside text (e.g. "it's") โ€” those stay, only the delimiters change.
  3. Convert Python literals too: None โ†’ null, True โ†’ true, False โ†’ false.
  4. Or paste it into JSON Wallet and click Repair to convert all single quotes to valid double quotes at once.

Before and after

Broken:

{ 'name': 'Ada', 'city': 'London' }

Fixed:

{ "name": "Ada", "city": "London" }

Want to fix your own JSON instead of the example? Open the editor, paste it in, and click Repair โ€” it runs entirely in your browser.

Frequently asked questions

Why does JSON only allow double quotes?

It keeps the grammar unambiguous and identical across every language. Allowing both quote styles would complicate parsers for no real benefit, so the standard picked one.

How do I convert single-quoted JSON without breaking apostrophes?

A naive find-and-replace of ' breaks words like it's. A proper repair tool understands the grammar and only swaps the delimiters. Paste it into the editor and use Repair.


Related JSON errors

For a full reference of JSON mistakes, read Common JSON errors and how to fix them.

Press โŒ˜ K for commands