Data formats can be confusing. CSV, JSON, TXT, and many more three or four-letter acronyms are out there. Time to bring some light into the dark.
CSV
CSV stands for comma-separated values. This is also exactly how it looks like in raw. It consists of data separated by commas:
fruit, price, weight
mango, 2.99, 0.5
apple, 0.99, 0.3
CSV was one of the early file formats in the computer age and still is widely used today. CSV was created to give data a table or spreadsheet structure. Commas indicate columns. In our example, one column contains the names of different fruits, the other one prices for fruits.
Separating values with commas is natural for humans to read and write. It is also easy for a computer to recognize the columns by splitting the file along commas.
JSON
JSON stands for java script object notation. It is a language that is used to introduce a little bit more complex structures into data. In particular, it is great for describing data that comes in hierarchies (or tree-structured data). This makes it, however, also a bit more complex to read. Here’s the same data as above in JSON format.
[
{
"fruit": "mango",
"price": 2.99,
"weight": 0.5
},
{
"fruit": "apple",
"price": 0.99,
"weight": 0.3
}
]