4 ms·
Please explain why the data format needs quotes around keys. And yes, I'm just sending data from server to client. I couldn't care less if it conforms to some
by axod 17y ago
Please explain why the data format needs quotes around keys.
And yes, I'm just sending data from server to client. I couldn't care less if it conforms to some spec or not. I want an efficient, useful data format.
>> The entire purpose is to get away from "eval". How do you like '{"test": window.close()}" in your JSON?
You're absolutely correct. but that is simple to protect against with a regexp, which is how the json parser at json.org works - regexp it, then eval().
My point is, that for my use case, the native JSON parser will mean an increase in bandwidth. Which is a pain - especially as there isn't a good reason for it.
- tlrobinson 17y agoHe did explain why: "This provides both future-proofing against later changes in ECMAScript (adding keywords), and simplifies the grammar for conforming parsers. Simpler grammars mean less opportunity for errors and non-conformant implementations." If it didn't require quotes, currently valid JSON may not be valid in the future if a new keyword which was use as a JSON object key was used unquoted. And there's the added complexity of supporting both quoted and unquoted keys.
- axod 17y agoA data format should NOT be concerned with language keywords.
- jsonscripter 17y agoUnless the data format is written in a language...