Search code examples
jsoninternet-explorerinternet-explorer-8internet-explorer-7

Error: 'JSON' is undefined in IE 7


Um getting an Error haying Error JSON undefined in IE 7 I have included the JSON2 library as follows

<script type="text/javascript" src="/2-0/javascript/flowplayer-3.2.6.min.js"></script>
<script type="text/javascript" src="/2-0/javascript/jquery-impromptu.js"></script>
<script type="text/javascript" src="/2-0/javascript/iscroll.js"></script>
<script type="text/javascript" src="/2-0/javascript/json_parse.js"></script>
<script type="text/javascript" src="/2-0/javascript/json2.js"></script>

But um still getting the error on this line in IE 7

data_array = JSON.parse(data)

How to fix this issue


Solution

  • The JSON object and related JSON.parse() and JSON.stringify() methods are only available for (reference):

    • Firefox 3.5+
    • IE 8+
    • Opera 10.5+
    • Webkit based (Chrome / Safari)

    There is no native support for JSON object in legacy browsers like IE7.

    You could enable it through including the json2.js created by Douglas here