You copied a data structure out of your code, saved it with a .json extension, and every tool you feed it to says the same thing: invalid. The data looks right. The braces match, the commas are in place, the values are sensible. The only difference from the JSON you have seen elsewhere is quiet and easy to miss: the keys and strings are wrapped in single quotes instead of double quotes.

That one difference is enough. JSON accepts double quotes and nothing else, and this guide explains where single-quoted text comes from, why parsers are unmoved by it, and how to convert a file safely using the free JSON Formatter and Validator on Ovatly to locate each problem.

Contents

  • Quick answer
  • What the JSON standard requires
  • Where single quotes come from
  • Why parsers refuse single quotes
  • How to fix single-quoted JSON, step by step
  • Worked example: the same object, two quote styles
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

JSON requires double quotes around every key and every string value. Text like {'name': 'Ovatly'} is not JSON, however reasonable it looks, and parsers reject it. To fix a single-quoted file, run it through the JSON Formatter and Validator: the error names the first offending quote in plain words. Re-quote the delimiters with double quotes, leave apostrophes inside words alone, and validate again until the file passes.

What the JSON standard requires

The quoting rule in JSON is absolute. Every key is a string, every string value is a string, and strings are written with double quotes. Numbers, booleans and null stand unquoted. There is no setting, no lenient mode and no version of the standard in which single quotes are an alternative spelling.

That strictness is deliberate. JSON was designed so that every parser in every language reads the same file the same way. One quote style means one grammar, no ambiguity about where a string starts and ends, and no dialect that works in one tool and fails in the next. The price of that reliability is that text written to looser rules has to be converted before a JSON parser will touch it.

Where single quotes come from

Almost nobody writes single-quoted JSON on purpose. It arrives by copy and paste from places where single quotes are legal. As a matter of general knowledge: people hand-write data files and reach for the quote key they use in prose; JavaScript object literals accept single-quoted strings, so an object copied out of JavaScript code keeps them; and Python prints dictionaries with single quotes, so a dictionary saved straight to a file looks like JSON while following Python's rules instead.

In each case the source was valid somewhere. The failure happens at the border, when text written for one rulebook is handed to a parser enforcing another.

Why parsers refuse single quotes

A parser reading JSON has one way to find the end of a string: scan for the closing double quote. A single quote is, to that parser, an unexpected character sitting where a double quote or a value should be. It cannot guess that you meant it as a delimiter, because guessing is exactly what a data format cannot do: two parsers guessing differently would read the same file as two different datasets.

There is a second, quieter reason the rule protects you. Apostrophes exist in real text: names, contractions, quoted speech. If single quotes delimited strings, every apostrophe inside a value would be a potential string boundary. The double-quote-only rule keeps that entire class of ambiguity out of the format.

How to fix single-quoted JSON, step by step

  1. Paste the file into the JSON Formatter and Validator and validate. The error names the problem in plain words and points at the first offending quote.
  2. Replace the delimiter quotes: the single quotes that open and close keys and string values become double quotes. Work through the file rather than swapping blindly, and check every single quote you meet for its role.
  3. Protect the apostrophes. A single quote inside a word, like the one in don't, is content. It stays as it is, safely inside the double quotes you have put around the value.
  4. Validate again. Fixing the first problem often reveals the next one, because the check reports the first fault it finds. Repeat until the file passes, then format it so you can read the structure and confirm nothing shifted.

Worked example: the same object, two quote styles

Written with single quotes, the object below is a Python dictionary printout or a JavaScript literal. It is not JSON:

{'name': 'Ovatly', 'tools': 250, 'free': True}

Re-quoted with double quotes, and with the Python-style capitalised True corrected to JSON's lowercase true, the same data becomes valid JSON:

{"name":"Ovatly","tools":250,"free":true}

Note that two things changed, not one. Quote style is the fault this guide is about, but copied text often carries a second dialect difference with it, and the validator will surface each one in turn as you fix and re-check.

Limitations and honest tradeoffs

The validator tells you what is wrong and where it starts; it does not rewrite the file for you. On a long document the re-quoting is manual work, and it has to be, because only a reader can tell a delimiter from an apostrophe. Expect several validate-and-fix rounds: the check stops at the first problem, so a file with fifty single quotes announces them one at a time.

Quote style is also rarely the only strictness issue in copied text. The same paste often carries trailing commas, unquoted keys or comments, all of which are equally invalid, and each will be reported as you clear the one before it. None of this is the tool being difficult; it is the standard being the standard.

Common mistakes

  • Blind find-and-replace on every single quote. Apostrophes inside values get converted into string boundaries and the file breaks in a new place. Judge each quote by its role.
  • Mixing quote styles in one file. Half-converted text, double quotes on keys and single quotes on values, is still invalid. The rule covers every string.
  • Assuming JavaScript object syntax is JSON. It looks close, but single quotes, unquoted keys and trailing commas are all legal there and all illegal in JSON.
  • Fixing the quotes and stopping at the first pass. A file can fail on quotes, then on a trailing comma, then on a capitalised True. Validate until it passes, not until the first error changes.

FAQs

Is single-quoted JSON ever valid? No. The JSON standard requires double quotes for keys and string values, and strict parsers reject single-quoted text. Some programming languages and looser formats accept single quotes in their own syntax, but that does not make the text JSON, and a JSON parser will still refuse it.

Why does my code accept single quotes but the JSON parser does not? Because code syntax and JSON syntax are different rulebooks. JavaScript object literals and Python dictionaries happily use single quotes, so data copied out of code often carries them. JSON kept only the double-quote rule, and anything written to the looser rules fails the stricter one.

Can I just find-and-replace every single quote with a double quote? That works only when no value contains an apostrophe. A word like don't carries a single quote that is content, not a delimiter, and a blind swap turns it into a string boundary and breaks the value. Long files with names, contractions and quoted speech need each quote judged on its role.

What error will I see for single-quoted JSON? The validator reports the problem in plain words, naming an unexpected character at the first offending quote. That first quote is where the re-quoting work starts, and fixing it often reveals the next one, since the check stops at the first problem it finds.

Will the formatter fix my quotes automatically? No. The tool validates your text and tells you in plain words what is wrong, and it formats JSON that is already valid. Converting single quotes to double quotes is editing, and the tool leaves that to you so that apostrophes inside values are handled by a human who can see their role.

Conclusion

Single quotes versus double quotes is not a style preference; it is the difference between text a JSON parser accepts and text it refuses. Convert the delimiters, protect the apostrophes, and let the JSON Formatter and Validator confirm each round until the file passes. Once it does, our companion guide on how to pretty print JSON copied from an API response shows how to lay the result out so its structure is easy to read. For more guides in this series, see our Data and JSON Tools guides.

References