Convert JSON arrays to CSV format. Nested objects are flattened with dot notation.
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 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 JSON | Cell in CSV | Note |
|---|---|---|
"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": null | empty | Looks 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
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.
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.
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:
München can then show as München. With the BOM option on, Excel reads it as UTF-8. Google Sheets, LibreOffice and Numbers read the file fine either way. Turn the option off if another program sees the BOM as part of the first column name.0012 as it is, but Excel turns it into 12. Long ID numbers can turn into scientific notation. Set those columns to Text when you import.=1+1 as '=1+1, so it stays text. See the section above.JSON.parse, which stores numbers exactly only up to 9,007,199,254,740,991. 12345678901234567890 comes out as 12345678901234567000. Keep long IDs as strings in quotes.{"b":1,"2":2,"a":3,"1":4} gives the header 1,2,b,a. Other keys keep their order.{"a.b": 1, "a": {"b": 2}}, both would give the column a.b. The tool keeps both. The first is a.b and the second is a.b_2, and an orange note under the status line tells you about it.{"a": 1} shows Input must be a JSON array. Put square brackets around it.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.
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.
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 {}.
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.
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.
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.
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.
No. The JSON is read and converted by JavaScript in your browser. Download CSV creates the file on your device. Nothing is uploaded.