JSONvXML

From KallestadWiki

Jump to: navigation, search

Data Transport Formats - JSON vs. XML

XML is probably the most universally recognized and supported format for data transfers. JSON is lesser known, but has performance and programming benefits over XML in certain situations.

JSON isn't necessarily a data transport format in and of itself. JSON stands for Javascript Object Notation, and quite simply is nothing beyond that.

XML has structure and support beyond what JSON offers.

At their heart, both are standard ways that you can define data structures. They can be used in many ways, but all the buzz is about transferring data from a client to a server or from a server to a client. In the most common scenarios, this is done over an http connection as an interaction with a web service.

Gaining a real understanding of these formats requires a lot of work, and a realistic comparison of what they offer is beyond the scope of this quick brain dump. I'm sure there are plenty of other resources on the web.

In my particular situation, I am concerned with web services in a relatively generic manner. I'm looking for both PERL and PHP support, and of course, client side support inside a web browser. PHP and PERL both support XML and JSON through a variety of methods across a variety of versions.

Frankly, the difference between the two comes down to this - JSON data handling / parsing in PERL, PHP, and Javascript is significantly faster, requiring significantly less code than XML. There are also fewer gotchas associated with JSON. Serialization of data structures is much simpler as well.

XML is more commonly supported from an integration standpoint. A great deal of web services and a great deal of web service support is reliant on XML - which means that any time an external integration point is defined and needs to be defined in such a way that the largest number of unknown potential integrations is feasible, XML must be supported. The flip side is that anytime you want to make it easy for a NOVICE to be able to define an integration, developing a HOW-TO on JSON development and building in JSON support is the most desirable situation.

I know this really based on my own experience. JSON is basically what I expected from XML and what it never has truly realized.

Personal tools