XML vs. JSON — How Many Data Structures Does It Take…

We’ve all probably seen the debates. Forums abound with web developers touting the pros of their preferred data structure while burning the other in effigy. What’s difficult to find in the sea of rhetoric is the actual answer. So we must ask ourselves, is there even an answer? Is one structure truly better than the other. Well as the tootsie roll pop owl said, let’s find out.

First, let’s discuss XML. XML (Extensible Markup Language) was endorsed by WC3 in early 1998, giving it the leg up on age. That age has given it the advantage of being widely utilized and accessible. Another plus for XML is it’s readability. A person with little to no understanding of data structures can look at an XML object and make safe assumptions as to it’s meaning. Finally, XML has multiple frameworks associated with it as well as being used by nearly 80% of the online APIs available.

Now onto JSON. JSON (JavaScript Object Notation) began being used around 2001 by State Software. While JSON is harder to read for some, programmers have no issues as the format is similar to most language’s arrays. JSON also takes up considerably less space when considering larger amounts of data because it does not require the closing tags that XML does. JSON is also far easier to process in a program. XML requires nested each loops for a complex structure while JSON can accomplish the same with a simple for loop.

Perhaps, however, I am not the owl with the answer in this case but the crotchety old turtle telling you to look somewhere else. Like maybe the current trends in web development. As of mid 2011, 20% of the API’s were using strictly JSON. This may not seem that high but when you consider this is up from less than 5% only 3 years prior it’s impressive. The fact is that JSON is preferred by web developers and those who offer APIs want to cater to those web developers. But then again, we could be wrong. After all, we all know that owl was just a sugar crazed scammer.

Trevor Boland
About Trevor Boland
Trevor is a staff writer for the iEntry Network.

Leave a Reply