← Back to the JSON tool

JSON to CSV

Last updated: 1 October 2026

Turn an array of JSON objects into a CSV table. Each object becomes a row, the keys become the columns, and the result is quoted the way a spreadsheet expects — all inside your browser, so the data never leaves the machine.

Runs in your browser No upload RFC 4180 quoting Excel-ready BOM Open source (MIT)

What the conversion does

A CSV file is a table written as plain text: one line per row, one delimiter between cells, and a header line naming the columns. JSON has no such shape. The natural crossing point is an array of objects, where each object is a record and its keys are the field names — that is exactly the layout an API returns for a list, so it is what this converter expects first.

Given [{"id":1,"name":"Ada"},{"id":2,"name":"Grace"}] the output is a header line id,name followed by the two rows 1,Ada and 2,Grace. Nothing is reordered and no value is reformatted beyond the rules below.

Which JSON shapes become a table

The union detail matters. If some records have a phone key and others do not, the header includes phone and the rows without it leave that cell empty — the column is not dropped. The clear consequence is that loosely-shaped JSON produces a table with sparse columns.

Nested values become text

A cell can only hold text, so an object or array nested inside a value is written as compact JSON inside its cell. {"address":{"city":"London"}} becomes the cell {"city":"London"}. The information survives, but it is no longer structured: this converter does not flatten address.city into a dotted column. If you want dotted columns, flatten the JSON first — that is a modelling decision, not a formatting one.

Quoting, delimiters and line endings

The output follows RFC 4180, the rule every spreadsheet and CSV library agrees on:

The delimiter is yours to choose. A comma is the default, but a semicolon is the safer pick on systems whose decimal separator is a comma, because a comma-delimited file is otherwise ambiguous there. Tab and pipe are available for data that already contains commas.

Opening the file cleanly in Excel

Excel does not read UTF-8 blindly: given a .csv with no byte-order mark it guesses the encoding and frequently guesses a legacy code page, which turns accented letters and CJK text into garbage. The BOM for Excel option prepends the three-byte UTF-8 mark to the downloaded file so Excel decodes it correctly. It is applied to the download only, so the text shown here stays clean.

What CSV cannot carry back

CSV is a text format and it is lossy. It forgets which values were numbers, booleans or null, and it flattens nesting into text. A null and an empty string both arrive as an empty cell, and a number arrives as its digits. Converting back to JSON returns strings unless you opt into type detection on the other page — and even then, a code such as 007 must stay a string to keep its leading zeros. Keep the original JSON when the types matter; treat CSV as the export, not the master copy.

Frequently Asked Questions

What shape of JSON can be converted to CSV?

CSV is a table, so the natural input is an array of objects: each object becomes a row and its keys become the columns. An array of arrays is used as rows verbatim, a single object becomes one row, and an array of plain values becomes a single column. Anything else — a bare number or string, or null — is not a table and is rejected.

What happens when objects have different keys?

The header is the union of every key seen anywhere in the array, in first-seen order. A row that lacks one of those keys simply leaves its cell empty. That is why a CSV built from loosely-shaped JSON can have columns that are blank for most rows.

How are nested objects and arrays handled?

CSV has no nesting, so a value that is itself an object or array is written out as compact JSON text inside its cell. The value is preserved, but it is no longer structured — a JSON to CSV conversion flattens by stringifying, it does not explode nested keys into dotted columns.

When does a field get wrapped in quotes?

A field is quoted when it contains the delimiter, a double quote, a newline, or leading or trailing whitespace. Inside a quoted field a literal double quote is doubled, so the text is reproduced exactly. That is the RFC 4180 rule, and it is what lets a single cell hold a comma or a line break.

Why does my CSV show mojibake in Excel?

Excel guesses the encoding of a .csv file and, without a byte-order mark, often guesses a legacy code page, which mangles non-ASCII text such as accented letters or CJK characters. Ticking the BOM option prepends U+FEFF to the downloaded file so Excel decodes it as UTF-8. The BOM is added only to the download, not to the text shown here.

Is a JSON to CSV conversion lossless?

No. CSV stores text, so it forgets which values were numbers, booleans or null, and it cannot represent nesting except as text. Round-tripping CSV back to JSON returns strings unless you ask for type detection. Keep the original JSON if you need the types back exactly.

Want the other direction? CSV to JSON reads a table back into an array of objects. Spotted a bug? Get in touch.