views:

24

answers:

1

If a browser doesn't support JSON.parse, would it make sense to include json.js and call parseJSON in lieu?

So the code would looks something like:

var z;

if (JSON.parse)
    z = JSON.parse(yada);
else
    z = JSON.parseJSON(yada); 
A: 

You could always use json2.js and keep using the standard JSON.parse/.stringify. json2.js adds those functions if the browser doesn't have them, with the same names so you can keep your calls simple.

Matti Virkkunen