CSV vs XML vs JSON – Which is the best response format?

Whether you're building a thin client (web application) or a huge client (client-server application) at a certain point, you probably send requests to the web server and need a good data format for the answers. Three major data formats have now been used to transfer data from a Web server to a client: CSV, XML, and JSON. To develop a solid architecture application, it's a good idea to understand the differences between each format and know when to use them. The purpose of the post is to determine the individual data formats, determine the benefits and disadvantages for each and to find out which situations best work with all formats.


CSV stands for "comma-separated values". As the name suggests, this data format is basically a comma-separated list of elements. Suppose the answer sends a list of people in that family. The format will look like this:

Eric, Andrea, Kusco

Benefits – This format is the most complex of all three formats. Generally speaking, CSV formats are about half of XML and JSON formats. This is the most important advantage of CSV because it can reduce bandwidth

Disadvantages – This format is the least versatile in all three formats. This is because a home analyst is required to convert CSV data into a native data structure. As a result, if the data structure changes, there is an associated additional cost to change or even redirect your commands. After CSV and the program after CSV on different machines (you remember sending data from one machine to another), since then, both programs must be updated at one time to prevent the host program crashing. Otherwise, a break-in is required to update both programs individually to prevent conflicts of interest.

Finally, CSV does not support the hierarchy of data. What would be the attributes you want to send to each individual in every family? You will then need to compile a composite analyst to know which parts of the CSV refer to a family element, and which parts refer to the element of each element. One way to resolve this issue is to use another delimiter, such as ";" separating the attribute of each person:

Eric; man; 26, Andrea; female; 26, Kusco; man;

However, the problem with creating custom formats is that additional costs are spent on maintaining an even more complex analyst.


XML is the term "extensible markup language". XML was designed in 1996 and officially became a W3C standard in 1998. This was created to better represent the data with a hierarchical structure. The format looks like this: Eric 26 Andrea 26 name> Kusco 8

supports hierarchical data structures it is very convenient if you receive complex data in response. It is very human. Most browsers contain built-in XML readers that allow you to check XML files. Because XML was the first standard hierarchical data format, most APIs have built-in functionality to automatically convert XML data streams to native data structures, such as objects.

Cons – This data format is three times the size of a CSV. This is because each data item has an associated open and close parameter tag.


JSON Report (Javascript Object Notation). It was invented in 2001 and was popularized in 2005 and 2006 by Yahoo and Google. It was created as an alternative to XML. Like XML, it also displays hierarchical data with comma, curved handles and brackets. The example of JSON looks like this:

{"name": "Eric", "age": "26"}, {19459014] {"name": "Andrea", "age": "26"
{"name": "Kusco", "age": "8"}

Benefits – This data format supports hierarchical data while being smaller than XML. As its name suggests, it was also created to better interpret data for native Javascript objects, making it very useful for web applications. JSON is the best of both worlds for CSV and XML. It's simple and compact like CSV, but it supports hierarchical data such as XML. Unlike XML, JSON formats are only about twice as large as CSV formats.

Disadvantages – This data format is slightly less supportive of XML. Because JSON is relatively new to XML, there are fewer APIs that JSON automatically transforms into native data structures. However, this changes rapidly because new APIs and extensions support both XML and JSON.


As a general rule, JSON is the best data exchange format so far. Lightweight, compact and versatile. CSV can only be used if you send huge amounts of data and if bandwidth is in question. Today, XML should not be used as a data exchange format because it is more suited to document markup.

Source by Eric D Rowell

Leave a Reply
