

ASK HN: Why json strings only accepts double quotation mark(")? - gagan2020

Today, I am parsing a document, which I coincidentally wrote as {'status':'ok'}. I spent lot of time checking browser requests and setting proper header and content-type to application/json.&#60;p&#62;Then, I remembered that somewhere I read that it accepts only double quotation mark. so I changed that to {"status":"ok"} and it worked like charm. Later I confirmed that from json.org also.&#60;p&#62;So, my question why only one quotation mark (i.e. " ) was supported by json? what were historical reasons for that.
======
kaolinite
Traditionally single quotes are used to represent a single character and
double quotes represent strings, so that's presumably where it came from. As
for why, I'm unsure. One of the great things about JSON is that its syntax is
very close to the syntax that many languages use for representing arrays and
the like, so perhaps it was to stay in keeping with languages like C where
strings cannot use single quotes. That's just a guess though and I personally
don't think it's a good enough reason - I'm always caught out by single quotes
in JSON.

