Formatters

Convert a JSON array of objects to CSV

JSON to CSV converter writes an array of objects as CSV: the header row holds every key found in the objects, in the order first seen, and each object becomes one row. Fields are quoted per RFC 4180 when they contain the delimiter, a quote, a line break or edge spaces, so the file opens correctly in a spreadsheet. Missing and null values become empty cells, numbers keep their exact spelling, and nested objects and arrays are written as JSON text inside their cell.

How to use JSON to CSV

  1. Open JSON to CSV in the Toolbox101 app.
  2. Paste an array of JSON objects into the JSON array box; a list response from an API works well.
  3. Pick the Delimiter your spreadsheet expects: comma, semicolon, tab or pipe.
  4. Read the CSV in the Output box: a header row, then one line per object.
  5. Click Copy to put the CSV on your clipboard, ready to open in a spreadsheet.

Worked example

JSON to CSV returns the output below for this input.

Input

[{"name":"Ada Lovelace","role":"Engineer","city":"London"},{"name":"Alan Turing","role":"Researcher","city":"Manchester"}]

Output

name,role,city
Ada Lovelace,Engineer,London
Alan Turing,Researcher,Manchester

Check it yourself: open JSON to CSV and enter the same input.

Frequently asked questions

What JSON shapes does this converter accept?

An array of objects, the usual list of records. An array of arrays is written as plain rows, an array of plain values becomes a single value column, and a lone object becomes one row. Mixing shapes in one array is reported as an error.

How are nested objects in a row handled?

Nothing is flattened. A nested object or array goes into its cell as JSON text, such as {"a":1}, quoted as needed, so no data is lost. Flatten the data first if you want separate columns.

Why do some cells come out empty?

A key that is missing from a row, or set to null, gives an empty cell. Columns come from every object, not just the first, so a field that appears only in later rows still gets its own column.

Are values escaped for spreadsheet apps?

Yes. A value that contains the delimiter, a double quote, a line break or leading or trailing spaces is wrapped in quotes with inner quotes doubled, as RFC 4180 specifies, so it stays in one cell when the file is reopened. The Delimiter list switches the separator to semicolon, tab or pipe for spreadsheets in locales that expect it.

Use JSON to CSV now

Runs in your browser. Nothing you type is uploaded.