Hunt
Skip to content

JSON to CSV

Paste a JSON array, such as an API response or a database export, to get a CSV you can open in Excel, Google Sheets or Numbers. Nested objects become address.city-style columns (or stay as JSON), the array of rows is found even when it's nested inside the response, and numbers keep every digit. Nothing is uploaded.

Runs in your browser

JSON

Paste JSON or press Sample

CSV

CSV will appear here

How JSON becomes rows and columns

Each item of the array becomes a row, and each key a column; the columns are every key that appears in any item, in the order they first appear, so items with different keys are handled. If the JSON isn't an array itself, the tool uses the largest array inside it, such as $.data.items in a typical API response; choose another under Rows from.

  • Flatten to columns turns {"address": {"city": "London"}} into an address.city column.
  • Keep as JSON puts the nested object in one cell as JSON text.
  • Arrays inside an item are always written as JSON text, so no data is lost.
  • null becomes an empty cell; true and false are written as text.

How to use the JSON to CSV

  1. Paste a JSON array, or press Sample.
  2. Check which array is used for the rows, and how nested objects are handled.
  3. Choose a delimiter and, for Excel, the Excel-friendly download.
  4. Copy the CSV or download it.

Examples

Nested objects flattened

Input
[{"id":1,"name":"Ada","address":{"city":"London","zip":"N1 9GU"},"tags":["admin","ops"]},{"id":2,"name":"Grace, Hopper","address":{"city":"New York"},"active":true,"note":null}]
Output
id,name,address.city,address.zip,tags,active,note
1,Ada,London,N1 9GU,"[""admin"",""ops""]",,
2,"Grace, Hopper",New York,,,true,

The second item has keys the first doesn't, so they become extra columns. Grace, Hopper is quoted because it contains a comma.

Rows inside an API response

Input
{"page":1,"data":{"items":[{"sku":"BK-12","price":19.90},{"sku":"PN-03","price":42}]}}
Output
sku,price
BK-12,19.90
PN-03,42

The array at $.data.items is used for the rows. The price keeps its trailing zero.

Semicolons for European Excel

Input
[{"product":"Notebook","price":"4,50"},{"product":"Pen","price":"2,00"}]
Output
product;price
Notebook;4,50
Pen;2,00

Opening the CSV in Excel

Excel guesses the file's character set and delimiter from your system settings. Excel-friendly download adds a UTF-8 byte-order mark so accents and emoji show correctly. In countries that use a comma as the decimal separator, Excel expects semicolons between fields: choose Semicolon as the delimiter.

Spreadsheets treat a cell starting with =, +, - or @ as a formula, even in a CSV. If the data comes from users, a cell like =HYPERLINK(…) could be harmful when the file is opened. Escape formulas prefixes such cells with an apostrophe, which spreadsheets hide.

Options

Rows from
Which array becomes the rows, when there's more than one. The largest is chosen by default.
Nested objects
Flatten to dotted columns (the default) or keep each nested object as JSON in one cell.
Delimiter
Comma (the default), semicolon, tab or pipe.
Excel-friendly download
Adds a UTF-8 byte-order mark to the downloaded file so Excel reads accents correctly.
Escape formulas
Prefixes cells starting with =, +, - or @ with an apostrophe to stop spreadsheets running them.

Limitations

  • Arrays inside items are written as JSON text, not spread across columns or rows.
  • Inputs up to 10 MB.

Frequently asked questions

Is my data uploaded?

No. The conversion runs in your browser; nothing you paste is sent anywhere.

Why does Excel show strange characters?

Excel doesn't assume UTF-8. Download with Excel-friendly download on, or use Data > From Text/CSV and choose UTF-8.

Why is everything in one column in Excel?

Your Excel expects a different delimiter, usually a semicolon where the comma is the decimal separator. Choose Semicolon and download again.

How do I convert CSV back to JSON?

Use the CSV to JSON converter.