Help: IE7 won’t load my JSON but IE8 will – Using a JSON Validator
I just ran into this issue, and found surprisingly little documentation. My JSON request wasn’t returning. I was using the jQuery “getJSON” method to send the request out. Nothing was coming back.
Here’s the code, pretty basic stuff:
[javascript]
$.getJSON(strSource, function(json){
// handle JSON here
alert(json.data)
}
[/javascript]
The code worked perfectly in Chrome, Safari, Firefox and even IE8. Internet Explorer is usually a problem when it comes to web pages, but I rarely expect IE7 to have issues (IE6 is usually the culprit).
In this case it turns out I had an extra “comma” at the end of the JSON data that didn’t belong. Other browsers gracefully degraded, but IE7 wouldn’t let it go.
I’m not saying IE7 should have worked, it was a mistake with my code.
How do you find and fix issues like this?
Solution
Use a JSON validator. Whenever you are having issues with JSON data (or the code that loads/manipulates that data), I frequently find the culprit is misformed JSON.
I use JSONLint to validate my JSON content.
So if you’re working with JSON, and are having issues with browsers working with the data appropriately, take a quick few seconds and validate your JSON.
Related Posts
1 Comment to Help: IE7 won’t load my JSON but IE8 will – Using a JSON Validator
Have you checked out the Microsoft IE Dev forum? Its a good source to take IE coding problems:
http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/threads?ocid=ie8_sm_a
Kyler IE Outreach Team
Leave a comment
Featured Posts
- HTML Fadein Fadeout: Basic Javascript/AJAX Tutorial using jQuery's fadeTo
- Basic AJAX Tutorial: Smooth Scrolling Text Marquee with a jQuery plugin
- Basic AJAX Tutorial: jQuery toggle and slide
- Hosting: How to pick a WordPress Host
- Basic jQuery Tutorial: Modify CSS classes and attributes, Hover and Toggle example
Follow Me
Email Subscription
Recent Posts
Top Commentators
- No commentators.
Archives
Tags
Blogroll
- 456 Berea St
- ActionScript 3 Design Patterns
- adactio – home of Jeremy Keith
- ajaxian
- Boxes and Arrows
- Chris Brogan
- CSS Globe
- InsideRIA
- Jarrod Michael Studios
- Mad Vertices
- NETTUTS
- Portsmouth Community Calendar
- Roomware Blog
- Signal vs. Noise
- Six Revisions
- Snook
- Style Grind
- Tiago’s Weblog
- Viget Extend
- Vitamin
- Whats the latest
- Why Banks Fail
- Woork
- zupko.info

March 24, 2010