IE7 expected a string, identifier or number

JSON is nice to read. It’s also nice when parsers are for­giv­ing, but here we are.

I just spent ages chas­ing [what I thought was] a bug using $.getJ­SON in IE7 that turned out to be an issue with some­thing else entirely.

If you’re using $(el).css or .ani­mate with JSON, make sure you’ve ter­mi­nated all items cor­rectly and don’t have any hang­ing com­mas left over:

Hanging comma at end of JSON params

This case sent me par­tic­u­larly crazy as I was also deal­ing with an actual JSON request in the same gen­eral vicin­ity that I’d val­i­dated a bunch of times and seemed perfect.

Note to self: Before you go down the white­space and text encod­ing rab­bit­hole next time, make sure you’re actu­ally check­ing the right JSON!

# by Josh Street on April 19th, 2012 Tags: , , ,
| 2 Comments »