Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

JSON to CSV Converter

Turn a JSON array into a spreadsheet-ready CSV file.

Use via API

Convert a JSON array of objects to CSV. Send JSON, get JSON back.

POST https://pithlab.com/api/v1/tools/json-to-csv

curl https://pithlab.com/api/v1/tools/json-to-csv \
  -H "Authorization: Bearer $PITHLAB_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"[{\"name\":\"Ada\",\"age\":36},{\"name\":\"Alan\",\"age\":41}]"}'

Fields and responseOpenAPI documentGet an API key

About the JSON to CSV Converter

Convert a JSON array of objects to CSV for Excel or Google Sheets. Flattens nested objects into dotted columns and quotes values correctly. Runs in your browser.

How to use the JSON to CSV Converter

  1. Paste a JSON array of objects, or press Example.
  2. Choose the delimiter: comma for most tools, semicolon for Excel in many European locales, or tab for TSV.
  3. Decide whether to include a header row and whether nested objects should be flattened into columns such as address.city.
  4. Copy the CSV or download it as a .csv file to open in a spreadsheet.

Examples

Array of objects with a nested field

Input

[{"id":1,"name":"Ada","address":{"city":"London"}},{"id":2,"name":"Grace, Jr.","address":{"city":"New York"}}]

Output

id,name,address.city
1,Ada,London
2,"Grace, Jr.",New York
Objects with different keys

Input

[{"sku":"A1","price":9.5},{"sku":"B2","stock":0}]

Output

sku,price,stock
A1,9.5,
B2,,0

Frequently asked questions

What JSON shapes can be converted?

An array of objects works best: each object becomes a row and the columns are every key that appears, in the order first seen. A single object, an array of arrays, or an array of plain values are also accepted.

How are nested objects and arrays handled?

Nested objects are flattened into dotted column names like address.city, unless you turn flattening off. Arrays are written as JSON text in a single cell, since they have no fixed number of columns.

Why does Excel put everything in one column?

Excel uses your system's list separator. In locales where the comma is the decimal separator, it expects semicolons, so choose the semicolon delimiter before downloading.

How are commas and quotes inside values escaped?

Following RFC 4180, any value containing the delimiter, a double quote, a line break, or leading or trailing spaces is wrapped in double quotes, and quotes inside it are doubled.