All tools

JSON to CSV converter

Turn a JSON array into a CSV file for Excel or Sheets.

JSON to CSV converter
Delimiter
Nested objects
Options
InputValid JSONJSON

Press Command or Control plus Enter to run. Tab inserts indentation; press Escape, then Tab, to leave the editor.

Result
Your result will appear here.
Ready5 lines · 346 chars

About the JSON to CSV converter

APIs and databases usually export data as JSON, but spreadsheets, reports and many import tools expect CSV. A JSON to CSV converter turns an array of objects into rows and columns that open directly in Excel, Google Sheets or Numbers.

This converter creates a column for every key it finds in any row, flattens nested objects into columns such as address.city, and quotes values correctly so commas, quotes and line breaks inside your data don't break the file.

How to use the JSON to CSV converter

  1. Paste a JSON array of objects into the Input editor, or click Load sample.
  2. Choose a delimiter and how nested objects should be handled.
  3. Click Convert to CSV or press Ctrl + Enter (Cmd + Enter on Mac).
  4. Click Download .csv to save a file, or Copy result to paste the text elsewhere.

Example

Array of objects to CSV with nested fields flattened

Input

[
  { "id": 1, "name": "Ada", "email": "ada@example.com", "team": { "name": "Core" } },
  { "id": 2, "name": "Linus", "email": "linus@example.com", "team": { "name": "Kernel" } }
]

Output

id,name,email,team.name
1,Ada,ada@example.com,Core
2,Linus,linus@example.com,Kernel

Nested objects become dotted column names like team.name.

Common errors and how to fix them

The JSON array is empty, so there are no rows to convert.

The array has no items. Check that you copied the data array itself, for example response.data, and not an empty placeholder.

Excel shows everything in one column

Your Excel region expects semicolons. Pick the ; delimiter, or use Data → From Text/CSV in Excel and choose comma as the delimiter.

Accented characters look broken in Excel

Excel on Windows can assume an older encoding. Open the file through Data → From Text/CSV and pick UTF-8, or save it with a byte order mark.

Good to know

  • Each object becomes a row. If a key is missing from some objects, those cells are left empty. A single object becomes one row, and an array of plain values becomes a single value column.
  • Arrays inside an object, such as ["admin", "editor"], are written into one cell as JSON text. null becomes an empty cell.
  • Values that contain the delimiter, a double quote or a line break are wrapped in quotes, and inner quotes are doubled, following the CSV standard (RFC 4180).
  • Downloaded files start with a UTF-8 byte order mark, so Excel shows accented letters and emoji correctly. Copied text doesn't include it.
  • Escape spreadsheet formulas adds a ' before text cells that start with =, +, - or @, so a spreadsheet shows them as text instead of running them as formulas. Turn it on when the data comes from users or other untrusted sources.

Frequently asked questions

Which delimiter should I use?

Comma works in most tools. If your Excel uses a comma as the decimal separator, which is common in Europe, choose semicolon so columns split correctly. Tab is useful for pasting straight into a spreadsheet.

Why do some values have quotes around them?

Quotes are required when a value contains the delimiter, a double quote or a line break. Spreadsheets remove them when opening the file, so the data appears exactly as in your JSON.

What is CSV injection?

A spreadsheet treats a cell starting with =, +, - or @ as a formula, which can run commands or leak data when the file is opened. Escaping adds a leading ' so the cell is shown as plain text.