←back to thread

Fixing JSON

(www.tbray.org)
139 points robin_reala | 1 comments | | HN request time: 0.293s | source
Show context
greenyoda ◴[] No.12327716[source]
I never understood why the double quotes around property names are mandatory. For example, in JavaScript, I can write

    { foo: 1, bar: 2 }
but JSON syntax insists on

    { "foo": 1, "bar": 2 }
This makes JSON less easily readable by humans, and harder to write or edit by hand.

Anyone know why JSON was designed this way?

replies(6): >>12327762 #>>12327775 #>>12327805 #>>12327829 #>>12327836 #>>12327945 #
1. jerluc ◴[] No.12327762[source]
I'm no expert, but I'd imagine fully dropping the quotes wouldn't allow you to use the same syntax as a map/dictionary in Javascript, whereby the keys could be [almost] any type, and string keys could contain characters such as - or even : which otherwise would prove ambiguous to a Javascript parser.