Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'JSON' is undefined error in IE only

I'm making an AJAX call to a WCF service and when I pass in my data i use JSON.stringify()

The call returns and works fine in FF, & Chrome, but not IE8. I get an error: 'JSON' is undefined

suggestions?

p.s. I also want this to work in IE7

like image 209
KevinDeus Avatar asked Feb 23 '11 16:02

KevinDeus


People also ask

Why is JSON value undefined?

The JSON-safe values are converted to their corresponding JSON string form. The JSON-unsafe values on the other hand return : undefined if they are passed as values to the method. null if they are passed as an array element.

What is undefined in JSON?

undefined is not a valid JSON value, even though it is valid in javascript. From the official JSON standard (ECMA-404, Section 5): A JSON value can be an object, array, number, string, true, false, or null. For JSON, use null instead of undefined: { "something": null }

Does undefined exist in JSON?

undefined , Function , and Symbol values are not valid JSON values.


1 Answers

Use json2 for a consistent cross browser implementation.

https://github.com/douglascrockford/JSON-js

like image 100
river Avatar answered Oct 08 '22 14:10

river