Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

JSON vs. XML

Apr 06

I’ve been doing a fair amount of research comparing JSON to XML. We do a good bit of XML transactions at work so it seems appropriate to research alternatives. While this post isn’t really about which approach is better I do want to share a couple of thoughts. First off, JSON appears to be much more lightweight and a bit easier to read than XML. I recently converted my RSS feed from XML, which at the time was about 46kB, to 23kB in JSON format. A pretty decent savings in size.

I’ve noticed a lot of JSON initiatives and the fact that many people are writing parsers appears to be a good sign. For a list of supported languages check out the bottom of this page. Even Yahoo and Zimbra are supporting JSON. I hate to jump on any sort of bandwagon, but in the Web industry if you don’t get on a bandwagon you get left behind. It’s always good to be open-minded about new approaches and that’s why I’m continuously researching alternatives. One of the oldies, but goodies, is Flash Remoting (a tough one to beat).

Today I stumbled across this great article that outlines a few pros and cons with XML and JSON. The author makes some great points that go beyond file sizes and parsing overhead. JSON is attractive because functions can be sent to the client and JavaScript code can be easily executed using the eval function. XML is attractive since it integrates so seamlessly with Ajax. I highly suggest reading the article and some great points are made about each technology.

While I’m not ready to jump from the XML ship I will definitely be experimenting more with JSON and will post more here. One thing’s for sure, JSON seems to be much more compliant with Flash since ActionScript is based from the same ECMA spec as JavaScript. That’s a pretty good thing since I tend to be a Flash junkie.

Leave a Reply