Actually, quoting is optional *EXCEPT* if member name contains spaces
or is a language-specific reserved word.

Try to jslint this fragment:

var JSONTest = {
    "jack johnson": "john jackson",
    "alice": "bob",
    "var": "error"
};

Unquoting alice makes no difference; doing the same for jack johnson
or var throws an error, but that's because we're dealing with
JavaScript: other languages could yeld errors on different reserved
words.

Then, in order to pre-emptively avoid such problems, my advice is to
*always* use member quoting.
-- 
unwiredbrain
Linux user #437712

Reply via email to