Open JSON File

Information, tips and instructions

Convert JSON To CSV

Both JSON and CSV are data storage formats. Both formats are textual, but the purposes and the structure of these formats are quite different. JSON was designed to store structured data with multiple levels of nesting, support of objects and arrays. CSV or Comma Separated Values is a columnar format designed to store table information. That is why conversion from JSON to CSV and vice versa is typically not a straightforward task. Only certain conversion scenarios are supported by the software and there may be some steps needed to prepare the data for such conversion.

Let’s consider the following JSON example:

[
 {
  "id":1, "name":"John Doe",
  "amount":150, "Remark":"Invoce #35"
 },
 {
  "id":2, "name":"Donald Duck",
  "amount":130, "Remark":"Invoice #45"
 },
 {
  "id":3, "name":"Amy James",
  "amount":120, "Remark":"Invoice #12"
 },
 {
  "id":4, "name":"Bill Atkinson",
  "amount":100, "Remark":"Invoice #84"
 }
]

This JSON is an array of entities each of which has a similar set of fields. This allows an easy conversion of it to CSV by using JSON object keys as field names and values as CSV data line values. The resulting CSV will look like one below.

id,name,amount,Remark
1,John Doe,150,Invoce #35
2,Donald Duck,130,Invoice #45
3,Amy James,120,Invoice #12
4,Bill Atkinson,100,Invoice #84

Here is another example of how JSON data may be structured to correctly convert it to CSV

{
  "id": [1,2,3,4],
  "name": ["John Doe", "Donald Duck", "Amy James", "Bill Atkinson"],
  "amount":[150,130,120,100],
  "remark":[" Invoce #35", "Invoice #45", "Invoice #12", "Invoice #84"]
}

In this example each key in the top level JSON object is a name of the corresponding column in CSV. And each object value is an array of “values” for each entity. It is not as straightforward as a first example but may be useful in many cases when JSON transformation is needed.

Both conversions described above are supported by convertcsv.com website. To learn about possible conversions, click on “Examples” under the JSON input box. You can also customize CSV output by clicking on the “Choose output options”. There you can change field separator, customize date format and remove header from the first row. To convert paste text, URL or upload the JSON file to convert to “Select your input” area of the site, select options in “Choose output options” and click “Convert JSON to CSV below”.