DevSwitch.net
Back to Tools
⇄

JSON to CSV Converter

Convert JSON data to CSV format

File Converters

Tip: Paste an array of objects. Each object becomes a row, and the header lists every key found in any object, with nested keys joined by dots.

Runs in your browser

Input JSON

Convert JSON to CSV in your browser

Paste JSON, open a .json file or drop it on the input window, and the CSV appears as you type. Each object of the array becomes one row, and each key becomes a column. Copy the result or download it as a .csv file for Excel, Google Sheets or a database import.

API responses are rarely flat. Nested objects and arrays are not lost: they are spread over extra columns named by their path, so every value gets a cell of its own.

JSON to CSV example

Real output for two user records. The address and the tags are flattened, and the second user gets an empty cell for the tag it lacks:

users.json
[
  {"id": 101, "name": "Ivo Marsh", "address": {"city": "Lisbon", "zip": "1100-148"}, "tags": ["admin", "beta"]},
  {"id": 102, "name": "Lena Fisk", "address": {"city": "Oslo", "zip": "0150"}, "tags": ["beta"]}
]
users.csv
id,name,address.city,address.zip,tags.0,tags.1
101,Ivo Marsh,Lisbon,1100-148,admin,beta
102,Lena Fisk,Oslo,0150,beta,

How nested JSON is flattened

A CSV row is flat, so every nested value is given a column named after its path:

  • JSON

    {"address": {"city": "Oslo"}}

    CSV

    Becomes a column address.city with Oslo in it. Deeper objects add more parts to the name.

  • JSON

    {"tags": ["admin", "beta"]}

    CSV

    Becomes tags.0 and tags.1, one column per position in the array.

  • JSON

    Objects with different keys

    CSV

    The header holds every key that appears in any object, in the order first seen. A row without that key gets an empty cell.

  • JSON

    null, {}, []

    CSV

    Become empty cells. true and false are written as the words true and false.

Which JSON can be turned into rows

JSON inputCSV output
An array of objects One row per object.
A single object One row.
An object whose only key holds an array, such as {"users": [...]} One row per item of that array, so a wrapped API response needs no editing.
An array of plain values, such as ["a", "b"] One column named value.

Need the JSON back?

The CSV to JSON converter reads the rows back into an array of objects, with numbers typed only where nothing is lost.

JSON to CSV questions

Click Open file and pick the .json, or drop the file on the input window. It is read in your browser and converted straight away; Download saves the result as a .csv file.

The key holds an array, and each position gets its own column: tags.0 is the first item, tags.1 the second. A row with a shorter array leaves the extra cells empty.

A value with a comma, a double quote or a line break is put in double quotes, and a quote inside it is written twice, as Excel and other CSV readers expect: "x""y".

The output window shows the parser's message with the position of the problem. To find and fix it, paste the JSON into the JSON beautifier, which also validates it.

No. Converting runs in your browser, and an opened file is read there too.