I’m reading that the best way to parse JSON in the browser is by using the JSON.parse() method.
Sorry, I’ve been living under a rock — where the hell did this JSON global object come from? Is it defined in some standard? Is it available in all browsers? When should I use Crockford’s json2.js instead?
It is part of ECMAScript 5, and is the Object with the internal class JSON that holds relevant methods (
stringifyandparse) for processing JSON data.Use the json2 library in browsers where JSON is not implemented.
You could test for it like this: