Back to All Tools

JSON to CSV Converter

Convert JSON arrays to CSV format. Nested objects are flattened with dot notation.

100% Private — Your data never leaves your browser. Everything runs locally on your device.

How the conversion works

The input must be a JSON array, so it starts with [ and ends with ]. Each item in the array becomes one row. For an object, each key becomes a column. The first row of the CSV holds the column names.

This is the example shown in the input box:

[
  {"name": "Alice", "age": 30, "address": {"city": "New York", "zip": "10001"}},
  {"name": "Bob", "age": 25, "address": {"city": "Chicago", "zip": "60601"}}
]

Convert to CSV gives this, and the status line says 2 rows, 4 columns:

name,age,address.city,address.zip
Alice,30,New York,10001
Bob,25,Chicago,60601

Rows do not need the same keys. The tool collects every key from every row, in the order it first sees them. A row without a key gets an empty cell. For example, [{"a":1,"b":2},{"b":3,"c":4}] becomes:

a,b,c
1,2,
,3,4

Nested objects and arrays

Nested objects are flattened at any depth. The keys are joined with a dot, as in address.city above. Arrays are a different story. The tool does not split them into rows or columns. It writes the whole array into one cell as compact JSON, so no data is lost and you can read it back with any JSON parser. This table shows what you get for each kind of value. The middle column is what a spreadsheet shows in the cell:

Value in JSONCell in CSVNote
"tags": ["a", "b"]["a","b"]In the CSV text the quotes are doubled: "[""a"",""b""]".
"items": [{"sku": "X"}, {"sku": "Y"}][{"sku":"X"},{"sku":"Y"}]The objects inside stay complete.
"m": [[1, 2], [3]][[1,2],[3]]Nested arrays work the same way.
"a": [][]
"e": {}{}The key still gets its column.
"a": nullemptyLooks the same as a missing key.
true, 0, ""true, 0, empty

If you want one row per item of an inner array, such as one row per order line, reshape the data before you convert. Make one object per line item and copy the order ID into each one.

Items in the top-level array do not have to be objects. A number, a piece of text, true, null or an array goes into a single column called value. So [1, 2, "x"] gives:

value
1
2
x

Commas, quotes and line breaks in values

CSV has one main rule for special characters, described in RFC 4180. A value that has a comma, a double quote or a line break is wrapped in double quotes. Each double quote inside it is written twice. The tool follows this rule. This input:

[{"note": "He said \"hi\", then left", "multi": "line1\nline2", "plain": "ok"}]

gives this output. The second value really spans two lines:

note,multi,plain
"He said ""hi"", then left","line1
line2",ok

Two small differences from RFC 4180: rows end with a line feed only, not a carriage return plus line feed. Spreadsheet apps accept both. The separator is always a comma. There is no option for semicolons or tabs.

Protection against spreadsheet formulas

Excel, Google Sheets and LibreOffice treat a cell that starts with =, +, - or @ as a formula. This is called CSV injection or formula injection. If your JSON came from other people, for example a form or an API, a value such as =HYPERLINK("http://example.com","Click") could become a working link, and some formulas can fetch data or run commands after a warning.

The option Protect against spreadsheet formulas is on by default. It puts a single quote ' in front of any text cell that starts with =, +, -, @, a tab or a carriage return. Then the spreadsheet shows the value as plain text. Column names are checked too. Real JSON numbers are not changed, so -5 stays -5. But the text "-5" or a phone number such as "+44 20" gets the quote.

The quote is written into the file. Some apps hide it and some show it as part of the text. If your data is your own and you need the exact values, for example to load the CSV into a database, turn the option off. The output updates at once when you change it.

Opening the file in Excel

Download CSV saves a file called data.csv in UTF-8. The option UTF-8 BOM for Excel is on by default. It adds a byte order mark (BOM) to the start of the downloaded file. A BOM is a small hidden marker that says which encoding the file uses. Copy CSV never includes it. Excel is where most problems appear:

Other things to know

If the input is not valid JSON, the status line shows the browser's error message. Our JSON Formatter page explains the common errors and how to fix them.

Frequently Asked Questions

What input does the tool accept?

A JSON array, which starts with [ and ends with ]. Each item in the array becomes one row. An object gives one column per key. A plain number, text, true, null or an array goes into one column called value. A single object is rejected, so wrap it in square brackets.

How are nested objects and arrays handled?

Nested objects become columns joined with dots, such as address.city. Arrays are not split up. Each array, including an array of objects or of other arrays, goes into one cell as compact JSON, so no data is lost. An empty object gives the cell {}.

What happens when rows have different keys?

The tool collects every key from every row, in the order it first sees them. A row that is missing a key gets an empty cell. A null value also gives an empty cell, so you cannot tell the two apart in the CSV.

Are commas, quotes and line breaks inside values handled?

Yes. A value with a comma, a double quote or a line break is wrapped in double quotes, and each double quote inside it is written twice, as RFC 4180 describes. Rows end with a line feed only, which spreadsheet apps accept.

What does Protect against spreadsheet formulas do?

It puts a single quote in front of any text cell that starts with =, +, - or @, a tab or a carriage return. Spreadsheet apps then show the value as text instead of running it as a formula. Real JSON numbers such as -5 are not changed. The option is on by default. Turn it off if you need the exact values.

Why do accented letters look wrong in Excel?

Excel on Windows may read a UTF-8 file with an older encoding, so München can show as München. The option UTF-8 BOM for Excel, which is on by default, adds a small marker to the downloaded file that tells Excel to use UTF-8. If you turned it off, import the file with Data, From Text/CSV and choose UTF-8.

Is my data sent to a server?

No. The JSON is read and converted by JavaScript in your browser. Download CSV creates the file on your device. Nothing is uploaded.