JSON object in IE6 - How? JSON object in IE6 - How? json json

JSON object in IE6 - How?


The json2 library at https://github.com/douglascrockford/JSON-js is exactly what you're looking for. You can include it unconditionally, and it adds JSON.parse and JSON.stringify to your global namespace (only if there isn't one defined yet). It won't mess with any built-in JSON. From its source:

if (!this.JSON) {    this.JSON = {};}...if (typeof JSON.stringify !== 'function') {...if (typeof JSON.parse !== 'function') {

That's comprehensive! Even if for some reason you already have JSON.stringify but not JSON.parse (or vice versa) it'll still do the right thing, leaving the original ones in place.


Your version of firefox might be having built-in support for the JSON library. But ideally you should include the JSON js library from json.org (make a copy of it in your hosted domain).


I also met this issue, you can load json2.js before using JSON. refer to this link.