Data Structures – Arguments for Using XML or JSON to Store and Transmit Object Data

data structuresjsonxml

My project lead considers both of these approaches to be unnecessary overhead. I have been involved in and have witnessed a lot of talk around XML vs JSON, but this is the first time that I have heard an argument against BOTH.

We are using c# in .Net 4. We'll be storing data in a sql server database on the server and also on mobile devices. I've heard all the arguments between the two but now I need to understand the arguments for and against the use of any object notation to store data – my project lead prefers csv format.

Best Answer

There are many libraries that will help you serializing and deserializing your data in XML or JSON. CSV is not so popular anymore, so you may need to do everything yourself. On top of that, both XML and JSON are probably easier to read for a human, which makes debugging easier and faster (i.e. cheaper).

CSV, on the other hand, has less characters for the same data so it takes less disk space and/or bandwidth.

Usually developer time (i.e. costs) is a much bigger constraint than disk space or bandwidth use, so most people will use XML or JSON. Using one or the other is a matter of which libraries you are most familiar with or even cultural reasons (Java and Scala people tend to use XML, Javascript people tend to use JSON). XML is more verbose (i.e. more disk, more bandwidth), but not to the point of being a problem in most modern projects.

If your boss is quite old, maybe he remembers the days when it made a difference to send data over the wire in a plain compact format (like CSV, or even an ad-hoc binary format) instead of XML, but that is very rarely an issue with modern computers and modern networks.

Related Topic