JSON to CSV
Every key becomes a column, so nothing is silently dropped.
The short answer
Every key that appears anywhere becomes a column, so an object missing a key gets an empty cell rather than being dropped or shifted. Fields are quoted only when they have to be, which keeps the file readable and still opens correctly in a spreadsheet.
Turns an array of objects into a CSV a spreadsheet will open. Objects missing a key get an empty cell rather than a shifted row, and fields are quoted only when they need to be.
The formula
collect every key in order of first appearance → one row per object
Worked examples
- [{"a":1},{"b":2}]
- a,b · 1, · ,2
- A nested object
- written as JSON inside the cell
- An array of numbers
- refused: a CSV needs objects
Reference table
| Value | In the CSV | Why |
|---|---|---|
| Plain text | As-is | No quoting needed |
| Text with a comma | In quotes | Or it would split the row |
| null or missing | Empty cell | A spreadsheet has no null |
| A nested object | JSON in one cell | CSV is flat, JSON is not |
How to use it
- 01Paste the JSONAn array of objects. A single object works too.
- 02Pick the separatorSemicolon if the file is going to Excel in a decimal-comma locale.
- 03Copy the CSVHeader row first, then one row per object.
Also searched for
Searches that land here include json to csv, convert json to csv, json csv converter, json to excel and json to spreadsheet.
Flattening JSON into rows
Columns come from the union of keys
The header is every key that appears in any object, in the order they were first seen. That means the shape of the CSV does not depend on which object happens to be first, and an object with an extra field cannot push everyone else's values into the wrong column.
Quoting only when needed
A field gets quotes when it contains the separator, a quote, a newline or leading or trailing spaces. Everything else is written plainly. The result is a file that is still readable in a text editor, which matters more than it sounds when you are trying to work out why a spreadsheet is misreading it.
What CSV cannot carry
Types. Nulls, distinct from empty strings. Nesting. Anything about which column is an identifier and which is a measurement. If any of that matters downstream, CSV is the wrong handoff format and JSON Lines or Parquet is worth the argument.
Questions people ask
What happens to nested objects and arrays?
They are written as JSON inside a single cell. CSV is flat and JSON is not, so there is no lossless way to spread a nested structure across columns without inventing a naming scheme. Keeping the JSON in the cell at least means nothing is lost, and a spreadsheet will show it.
Why do some rows have empty cells?
Because those objects did not have that key. Every key that appears anywhere becomes a column, and objects without it get an empty cell. That is the safe behaviour: the alternative is dropping the column or shifting values into the wrong one.
Will Excel open it correctly?
Usually, and the separator is the thing to watch. Excel expects your locale's list separator, so a comma-separated file opens as one column in a German or French install. Use the semicolon option for those, or open it through Data, From Text rather than by double-clicking.