JSON on IE6 (IE7)

JsonInternet ExplorerInternet Explorer-7Internet Explorer-6

Json Problem Overview


Sorry for my inpatience but after weeks staying up late and just having put my web online, I just don't have any left energy to debug... I just can't Google how to implement JSON on IE6 & IE7... I'm using

JSON.stringify(...)

From what I understand JSON is not built in on IE6-7 and has to be dynamically added in in-line code... how do you do that?

I already have jQuery - is it my correct understanding that their JSON engine relies on the browser native one?

Then some comment on invalid JSON code that makes IE6-7 fail, but I thought it wasn't native in IE6-7?

Anyone?

Json Solutions


Solution 1 - Json

Since you want to use the JSON.stringify method, you will need to include the JSON3 parser in order to support it on IE < 8.

This library complies with the standard methods of the ECMAScript 5th Edition specification and it checks if there is a native implementation available, so on modern browser this native implementation will be used.

Solution 2 - Json

There must be something misunderstood. The object notation has been in JavaScript for a while now (as far as I understand, it's a core concept of JavaScript). I mean, the ability to write code like var o= {a:"b"};
So, if you can do this, you can also call eval('var o= {a:"b"};') and that's the way you "implement JSON" in any browser.

UPDATE: Re-read your post and finally got the point that the problem is serializing objects, not deserializing them. Then you can use the JavaScript library for that: https://github.com/douglascrockford/JSON-js/blob/master/json2.js

Solution 3 - Json

Just include https://github.com/douglascrockford/JSON-js">json2.js</a> in your file to play around with JSON. It'll also work in IE 9 .

Solution 4 - Json

"dynamically added in-line code" is using the functionality provided by Douglas Crockfords json2 library, or jQuery's own implementation if the browser version doesn't support it natively.

jQuery does not rely on any JSON decoding functionality provided by the browser. If the browser does support JSON decoding, then jQuery will use it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid ThorissonView Question on Stackoverflow
Solution 1 - JsonChristian C. SalvadóView Answer on Stackoverflow
Solution 2 - JsonnaivistsView Answer on Stackoverflow
Solution 3 - JsonPadhuView Answer on Stackoverflow
Solution 4 - JsonMattView Answer on Stackoverflow