Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the relative merits of CSV, JSON and XML for a REST API?

Tags:

People also ask

What is the main advantage using XML or JSON over using CSV?

JSON is the best of both worlds with respect to CSV and XML. It's simple and compact like CSV, but supports hierarchical data like XML. Unlike XML, JSON formats are only about twice as large as CSV formats.

CAN REST API use XML and JSON?

The REST architecture allows API providers to deliver data in multiple formats such as plain text, HTML, XML, YAML, and JSON, which is one of its most loved features.

What is CSV XML and JSON?

Contents. JSON – JavaScript Object Notation. XML – Extensible Markup Language. CSV – Comma Separated Values.

What is the advantage of JSON over CSV?

About JSON format JSON-formatted files have several benefits over CSV: JSON maintains hierarchical structures, making it easier to hold related data in a single document and represent complex relationships.


We're currently planning a new API for an application and debating the various data formats we should use for interchange. There's a fairly intense discussion going on about the relative merits of CSV, JSON and XML.

Basically, the crux of the argument is whether we should support CSV at all because of the lack of recursion (i.e. having a document which has multiple authors and multiple references would require multiple API calls to obtain all the information).

In the experiences you may have had when working with information from Web APIs and things we can do to make the lives easier for the developers working with our API.


Our decision:

We've decided to provide XML and JSON due to the difficulty in recursion in CSV needing multiple calls for a single logical operation. JSON doesn't have a parser in Qt and Protocol Buffers doesn't seem to have a non-alpha PHP implementation so they are out for the moment too but will probably be supported eventually.