Can someone tell me what the difference is between the 2 json files?
I have a JSON file from 2007-04-13 (It has methods such as parseJSON). I don't see these methods in any of the new versions.
Can someone tell me what the difference is between the 2 json files?
I have a JSON file from 2007-04-13 (It has methods such as parseJSON). I don't see these methods in any of the new versions.
From their code:
// Augment the basic prototypes if they have not already been augmented.
// These forms are obsolete. It is recommended that JSON.stringify and
// JSON.parse be used instead.
if (!Object.prototype.toJSONString) {
Object.prototype.toJSONString = function (filter) {
return JSON.stringify(this, filter);
};
Object.prototype.parseJSON = function (filter) {
return JSON.parse(this, filter);
};
}
I guess parseJSON is absolete, therefore the new version (json2) doesn't even use it anymore. However if your code uses parseJSON
a lot you could just add this piece of code somewhere to make it work again:
Object.prototype.parseJSON = function (filter) {
return JSON.parse(this, filter);
};
How would you use json2.js. I am trying to call a remote json service. What would be the steps to make to do this? How would I call the JSON service, how would I use the JSON2.js and what is the Javascript I would use to tie all of this together?