Odd JSON Date Formats

For some reason, they decided to use the ASP.NET AJAX / WCF Web Services date format (“\/Date(1399100400000-0700)\/”) for the Bing Webmaster API JSON response instead of the more conventional ISO 8601 format (“2014-05-02T11:23:31.324Z”) used in the XML response.

If you’ve never seen one of these, I feel for you. The big number is the number of milliseconds since Unix EPOCH (Jan. 1, 1970), followed by a timezone offset. Of course, the timezone offset is in hours / minutes, so -0700 means -7 hrs from UTC/GMT, and you’ll have to either find a utility to do the conversion for your chosen language, or parse the hours and minutes, and use those to offset the milliseconds delta. Ugh.

Oh, and just to keep things interesting, in some responses, there is no timezone portion. I think this is supposed to mean ‘just use the date, not the time’, but if your utility automatically converts to local timezone, having a zero offset could cause you to get the wrong date. Sigh…