XML vs JSON


by Jamie Simpson

When XML was introduced to the programming world, it was considered brilliant in it's simplicity. A text based protocol that would self-describe the data that it contained, and an ability to carry hierarchical data. Quickly adopted by programmers using various languages, XML was easily the most widely adopted method for sharing data between disparate systems.

This not only allowed autonomous systems to communicate seamlessly, it replaced a lot of existing EDI transmission types and the business analysts who worked with the data sets moved from using a text reader to finding a good XML editor. XML was, in many ways, superior to traditional X12 data formatting, as it was more legible and easily more comprehensible by humans.

XML becoming the standard for data communications soon found its way into online applications, and although it was first used primarily as a communication protocol between web services, there was another usage that showed some of the first disadvantages of the format. Ajax, a catchy term for asynchronous web programming, began creeping into more and more web applications, and as the software became increasingly complex, the data that was being transmitted followed suit. No longer could single parameter values be passed as sufficient. The need for large amounts of data, often hierarchical, to be passed almost invisibly between client and server meant that XML needed to be built to contain the data. This meant that the legibility of XML suddenly increasing the data size being transmitted, and the need for parsing and navigating the data on both ends.

This development made XML less attractive, as much of the structure had to be hard coded and baked into the application, not only adding overhead to the data being transmitted, but it introduced rigidity that XML was normally impervious to. This is where JSON, another formatting protocol, found a niche by solving a problem. JSON did not have the extensive overhead of XML, being designed instead for compression of string data and therefore, efficiency in the sense of the type of usage best suited for an asynchronous callback.

In addition, JSON's formatting meant that the removal of the explanatory data and node structure decreased the need to hard code a rigid structure into the transmission. While JSON still requires a structure to be parsed, the intent is less on being legible to the human eye and more on being understandable by the back end logic.

As far as comparison of the two formats, it isn't a matter of one being 'better' than the other. It is a matter of which tool is better for the job at hand. In the case of sending data from one endpoint to another, such as in the case of two web services or restful services on two different servers, XML is almost always going to be the right choice. However, in the case of data being transmitted internally within an application, especially in an ajax callback, JSON is more likely the better and more efficient choice. The two formats should not be considered mutually exclusive.

About the Author

For more information about XML visit http://www.liquid-technologies.com/XML-Editor.aspx

Tell others about
this page:

facebook twitter reddit google+



Comments? Questions? Email Here

© HowtoAdvice.com

Next
Send us Feedback about HowtoAdvice.com
--
How to Advice .com
Charity
  1. Uncensored Trump
  2. Addiction Recovery
  3. Hospice Foundation
  4. Flat Earth Awareness
  5. Oil Painting Prints