CSV vs XML vs JSON – Which is the Greatest Response Information Format?

Whether or not you might be constructing a skinny consumer (internet utility) or thick consumer (client-server utility) in some unspecified time in the future you might be most likely making requests to an online server and want a very good knowledge format for responses. As of at present, there are three main knowledge codecs getting used to transmit knowledge from an online server to a consumer: CSV, XML, and JSON. In an effort to develop an utility with a stable structure, it is a good suggestion to know the variations between every format and know when to make use of them. The aim of this submit is to outline every knowledge format, lay out the professionals and cons for every, and uncover which conditions work greatest with every format.


CSV stands for “comma separated values”. Because the identify implies, this knowledge format is mainly an inventory of parts separated by commas. For example that your response is sending again an inventory of individuals in a specific household. The format would appear to be this:


Execs – This format is probably the most compact of all three codecs. Typically talking, CSV codecs are about half the scale of XML and JSON codecs. That is the most important benefit of CSV as a result of it might probably assist cut back bandwidth

Cons – This format is the least versatile of all three codecs. It’s because a selfmade parser is required to transform the CSV knowledge right into a native knowledge construction. Because of this, if the info construction adjustments, there’s an related overhead of getting to vary and even redesign your parsers. Moreover, for the reason that program creating the CSV and this system parsing the CSV reside on completely different machines (keep in mind that we’re passing knowledge from one machine to a different) then each packages should be up to date concurrently to stop the receiving program to crash. In any other case, an outage is required to replace each packages individually to stop incompatibility points.

Lastly, CSV does not likely assist knowledge hierarchies. What in the event you needed to ship again attributes for every individual in every household? You’d then should design a fancy parser that is aware of which elements of the CSV are referring to parts of a household, and which elements are referring to parts of every individual. One option to resolve this downside is to make use of one other delimiter like “;” to separate every individual’s attribute:


The issue with creating personalized codecs, nonetheless, is that you just incur an overhead of sustaining an much more complicated parser.


XML stands for “extensible markup language”. XML was designed in 1996 and formally grew to become a W3C normal in 1998. It was created to raised symbolize knowledge codecs with a hierarchical construction. The format seems like this:

<person><name><br> Eric<br></name><br><age><br> 26<br></age></person><person><name><br> Andrea<br></name><br><age><br> 26<br></age></person><person><name><br> Kusco<br></name><br><age><br> eight<br></age></person>

Execs – This knowledge format totally helps hierarchical knowledge constructions and could be very acceptable when receiving complicated knowledge as a response. It is usually very human readable. Most browsers have inbuilt XML readers that can help you examine XML recordsdata. Since XML was the primary normal hierarchical knowledge format, most APIs have inbuilt performance to robotically convert XML knowledge streams into native knowledge constructions like objects.

Cons – This knowledge format is about thrice as giant as CSV. It’s because every knowledge component has an related open and shut parameter tag.


JSON stands for (Javascript Object Notation). It was invented in 2001 and have become popularized by Yahoo and Google in 2005 and 2006. It was created as an alternative choice to XML. Like XML, nonetheless, it represents hierarchical knowledge with using commas, curly braces and brackets. An instance of JSON seems like this:



Execs – This knowledge format helps hierarchical knowledge whereas being smaller in measurement than XML. As its identify implies, it was additionally created to extra simply parse knowledge into native Javascript objects, making it very helpful for internet purposes. JSON is the most effective of each worlds with respect to CSV and XML. It is easy and compact like CSV, however helps hierarchical knowledge like XML. Not like XML, JSON codecs are solely about twice as giant as CSV codecs.

Cons – This knowledge format has a bit bit much less assist than XML. Since JSON is comparatively newer than XML, fewer APIs exist to robotically convert JSON to native knowledge constructions. Nonetheless, that is quickly altering as a result of newer APIs and plugins are supporting each XML and JSON.


As a normal rule of thumb, JSON is the most effective knowledge trade format thus far. It is mild weight, compact, and versatile. CSV ought to solely be used if you’re sending big quantities of knowledge and if bandwidth is a matter. Right this moment, XML shouldn’t be used as a knowledge trade format as a result of it is higher suited to doc markups.

Supply by Eric D Rowell

Leave a Reply

Your email address will not be published. Required fields are marked *