4 ms·
JavaScript has pretty good, native JSON support.
by applecore 11y ago
JavaScript has pretty good, native JSON support.
- sopooneo 11y agoWhat do we mean by that? Hasn't JavaScript always had native JSON support since whenever "eval()" was included?
- sinatra 11y agoI think applecore's comment was tongue-in-cheek considering JSON is JavaScript Object Notation and was originally derived from JavaScript.
- TazeTSchnitzel 11y agoeval() isn't quite the same. It's unsafe for starters: it permits any JS code, not just JSON. But JavaScript has the JSON object offering a high-quality, high-performance parser (JSON.parse) and serialiser (JSON.stringify).
- ape4 11y agoIts funny how JSON emerged as subset of JavaScript - easy to parse with eval(). But now if you do that its terrible code. So the subset aspect is totally irrelevant now.
- heydenberk 11y agoThe subset aspect is indeed still relevant. JSONP callbacks[0] make use of JSON's just-JavaScript nature. [0] https://en.wikipedia.org/wiki/JSONP https://en.wikipedia.org/wiki/JSONP
- TazeTSchnitzel 11y agoIn old browsers, yes. The much more secure CORS is now an option, however.