Quick question. Is there any need to include the Json2 library anymore? Did I read somewhere that JavaScript supports JSON as standard these days so there’s no need to parse it anymore?
Any advantages or disadvantages to Json2 vs standard JavaScript support?
JSONwas standardised in ECMAScript 5, so browsers that conform to that specification includeJSON, but others browsers don’t (such as those that were released before ECMAScript 5/ IE). If you need to support these browsers, you still need to include it.Specifically,
JSONwas introduced in:json2.jschecks whetherJSON.parseis already implemented, and only provides it’s implementation if it doesn’t; so think of it as a sort of polyfiller for older browsers.Sources: http://kangax.github.com/es5-compat-table/, http://caniuse.com/#feat=json