Skip to main content
CalcChef

JSON to CSV

Turn JSON into CSV: an array of objects, one object or a list of values. Flatten nested objects, expand arrays into rows, then copy or download. How it works

Use the JSON to CSV

Drop a .json file here, click to upload, or

CSV output
2 rows, 3 columns

About the JSON to CSV

[{"name":"John","age":30,"city":"NYC"},{"name":"Jane","age":25,"city":"London"}] becomes three lines: the header name,age,city, then John,30,NYC and Jane,25,London. This JSON to CSV converter turns an array of objects, a single object or an array of plain values into CSV with one column per key, quotes any cell that holds the delimiter, a double quote or a line break, and lets you leave out or rename columns. Two options flatten nested objects into a.b columns and expand nested arrays into rows.

How a JSON value is written as a CSV cell

JSON valueCSV cellWhy
"Smith, John""Smith, John"contains the delimiter
"He said \"hi\"""He said ""hi"""a double quote is doubled
1.501.5a number is written as the browser reads it
truetruewritten as text
null(empty cell)null is an empty cell
["a","b"]"[""a"",""b""]"a nested array is JSON text in one cell
{"x":1}"{""x"":1}"a nested object is JSON text in one cell
"=SUM(A1)"'=SUM(A1)starts with =, so it gets an apostrophe
"+15551234567"'+15551234567starts with +, so it gets an apostrophe
"@home"'@homestarts with @, so it gets an apostrophe
"-abc"'-abcminus then text gets an apostrophe
"-2+3"'-2+3minus then anything but a plain number gets an apostrophe
"-5"-5a minus followed only by a number is left alone
1234567890123456789012345678901234567000beyond 2⁵³ the browser rounds it

Each row is one value in a one-column array, converted with a comma delimiter and both reshaping options off. A key that is missing from an object also gives an empty cell.

How to use this tool

  1. Paste a JSON array of objects, a single object or an array of values, or drop or upload a .json file.
  2. Tick Flatten nested objects to give each nested key its own column, or Expand nested arrays into rows to repeat a row once per array item.
  3. Choose the delimiter: comma, semicolon, tab or pipe.
  4. Press Convert, or switch Live on to convert as you type. If you edit the input after converting, the page says the CSV is from the earlier input.
  5. Open Columns to untick or rename columns and Table to preview up to 100 rows, then press Copy CSV or Download CSV.

Frequently asked questions

How do I convert JSON to CSV?
Paste a JSON array of objects, choose a delimiter and press Convert. Each object becomes one row and each key becomes a column. Download CSV saves the file as converted.csv, or converted.tsv when the delimiter is a tab, and Copy CSV puts the same text on the clipboard to paste into a spreadsheet.
What happens to nested objects and arrays?
By default they are written as JSON text in a single cell, with the quotes doubled: [{"x":1}] gives "{""x"":1}" in the cell. Tick Flatten nested objects and each nested key gets its own column, such as customer.name, up to 50 levels deep. Tick Expand nested arrays into rows and the row repeats once per item: with both on, [{"order":1,"items":[{"sku":"A"},{"sku":"B"}]}] gives order,items.sku, then 1,A and 1,B. Two arrays in one object give every combination, and more than 100,000 rows stops with a message.
Why is there an apostrophe in front of some values?
A spreadsheet can run a cell that starts with =, +, - or @ as a formula. OWASP lists this as CSV injection and suggests a leading apostrophe. The tool adds one to values that start with =, + or @, a tab, a line break or the full-width =, + and @, and to values that start with - unless the whole value is a plain number: =SUM(A1) becomes '=SUM(A1), -2+3 becomes '-2+3, and so does a phone number such as +15551234567. A value such as -5 is left alone. The apostrophe is written into the file as part of the cell text, so a spreadsheet that opens the CSV may show it, and there is no setting to turn it off. Delete it in the spreadsheet for values you know are plain text, such as phone numbers.
How are commas, quotes and line breaks handled?
A cell that contains the delimiter, a double quote or a line break is wrapped in double quotes, and each quote inside is doubled, as RFC 4180 describes. Smith, John becomes "Smith, John". Header names follow the same rule.
Will Excel show the right characters?
The file is UTF-8 without a byte order mark. Whether Excel shows accented letters correctly on a double-click depends on its version and settings, which this page does not test. If letters look wrong, import the file and choose UTF-8 as the encoding.
What JSON does it accept?
A single object (one row), an array of plain values such as ["red","green"] (one column named value) or a non-empty array of objects, up to 1,000,000 characters. The columns are every key found in any object, in the order each first appears (within one object, a key that is a whole number such as 2 comes before the text keys, as JavaScript lists them); a missing key is an empty cell. An array of arrays, or one that mixes objects with plain values, is rejected with a message. Integers longer than about 16 digits lose their last digits, as the last row of the cell table shows.

Related Tools

View all tools