Skip to the JSON editor
JSON Formatter Viewer

JSON to CSV

input.json

output.csv

The CSV appears here.

or drop a .json file into the left pane

Waiting for input

What the conversion does

The input has to be an array of objects — that is the only JSON shape that maps onto rows and columns without guesswork. Each element becomes one row. The header is the union of every key seen across all elements, so a document whose records disagree about which fields are present still produces a rectangular file.

[{"id": 1, "name": "Ada"}, {"id": 2, "city": "Paris"}]

id,name,city
1,Ada,
2,,Paris

Quoting

A field is quoted when it contains a comma, a double quote, a carriage return, or a line feed. A literal double quote inside a quoted field is written as two quotes. That is exactly what RFC 4180 prescribes, and it is what every spreadsheet and CSV library expects — so a value likeHello, "world" survives the round trip intact.

Nested values

Objects and arrays inside a cell are serialised back to compact JSON rather than being flattened into extra columns. Flattening is tempting but lossy in practice: two records can nest to different depths, arrays have no natural column name, and the resulting header explodes. If you do want a flat shape, reshape the JSON first — the tree in the viewermakes it easy to find the array you actually want to export.

Getting back

The CSV to JSON converter reverses this. The round trip is not perfectly lossless — CSV has no types, so numbers and booleans are re-inferred on the way back, and a zero-padded id like 007 deliberately stays a string.

Common questions

Why does it say "CSV needs an array of objects"?

Only for input that has no rows in it — a scalar, or an array whose elements are not all objects. A single object converts to a one-row file, and an {"data": [...]} envelope wrapping exactly one array of objects converts to that array. If a document holds two candidate arrays it is ambiguous, so the whole object becomes one row instead — open it in the viewer and copy the array you actually want.

What happens to nested objects and arrays?

They are written into the cell as JSON text. Flattening address.city into its own column would invent a schema that the document does not have, and it breaks the moment one row nests deeper than another. Keeping the JSON in the cell is lossless.

How are the columns chosen?

The header is the union of every key across every row, in the order each key is first seen. A row missing a key gets an empty cell rather than being skipped, so the output stays rectangular.

Are commas and quotes inside values handled?

Yes. Any value containing a comma, a double quote, or a line break is wrapped in double quotes, and embedded quotes are doubled — the escaping RFC 4180 specifies. Excel, Google Sheets, and pandas.read_csv all read the result without extra flags.

The rest of the toolkit

Same engine, same privacy — every page runs entirely in your browser.