JSON object undefined in Internet Explorer 8 JSON object undefined in Internet Explorer 8 json json

JSON object undefined in Internet Explorer 8


Make sure you're actually in IE 8 mode by using the preferred method, a standards doctype...

<!DOCTYPE html>

...or the undesired method, the X-UA-Compatible meta tag/header...

<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />

See Defining Document Compatibility for more information.


Using jQuery.parseJSON solved this for me, in case you are already using JQuery.


Other things that absence of doctype or wrong doctype, or some error with html syntax, will force IE to use document modes different from what you expect.

I was using simple "" in a test document and the absence of TITLE tag as a child of HEAD tag made window.JSON become undefined.

Remember always that it's better to test the resource against the version of browser. And, if your users can use IE's with emulation of document modes, it's better you have a piece of code to provide the JSON.parse and JSON.stringify when natives are undefined.