Resolve JSON is Undefined Error in Internet Explorer

While running JSON code like the one shown below, older browsers like IE7 produces the error - ‘JSON’ is undefined:

JSON code

JSON is undefined

The error occurs while executing the JSON.parse() method by older browsers that have not implemented the JSON object. The solution to this error is to download the json2 library and include it in your script, as shown below:

Json2.js script

The application uses the json2.js library for browsers that haven’t implemented the JSON object yet. After adding the json2.js library, you can now test the application on IE7 and you will get the desired output


Note: All the latest browsers like Firefox 3.5+, IE 8+, Chrome, Safari 4+ etc. have built-in JSON capability.

You also want to look at Is my JSON valid?

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook

Follow him on twitter @suprotimagarwal


14 Responses to "Resolve JSON is Undefined Error in Internet Explorer"
  1. Anonymous said...
    January 17, 2011 at 7:53 AM

    I get this error on IE8 also.

  2. Suprotim Agarwal said...
    January 17, 2011 at 9:00 PM

    That could be as you are running IE8 in compatibility mode?

  3. Lucho said...
    January 18, 2011 at 7:54 PM

    Thanks a lot man. It really helped me out. Many thanks from Argentina =) Have a good day! bye.

  4. Anonymous said...
    March 17, 2011 at 10:19 AM

    Perfect one..
    Thanks a lot..

  5. wildkaz said...
    July 19, 2011 at 7:23 AM

    Awesome man. You saved my life. Thanks (*follow*)

  6. Srinivasan said...
    September 22, 2011 at 1:34 AM

    Its really cooll man.

  7. balaram said...
    December 11, 2011 at 9:22 PM

    thanks it works for me perfectly

  8. mjwouda said...
    February 16, 2012 at 6:01 AM

    Excellent! Finally I get the Google Maps API in IE7 working! Thanks for sharing.

  9. Anonymous said...
    May 9, 2012 at 10:30 AM

    Oh man. Thanks for this help. You saved my week

  10. Anonymous said...
    June 19, 2012 at 4:19 AM

    Thank you! You solved my problem!

  11. Anonymous said...
    August 20, 2013 at 4:29 AM

    Thanks alot saved my life.

  12. Anonymous said...
    September 29, 2013 at 11:50 PM

    I included json2.js file but json invalid error is given in IE8

  13. Anonymous said...
    September 29, 2013 at 11:51 PM

    Pls give me solution

  14. Bhartendu Vimal said...
    October 23, 2013 at 10:39 PM

    Thank you very much.
    From INDIA. :)


Copyright © 2009-2016 All Rights Reserved for by Suprotim Agarwal | Terms and Conditions