JSON1 / JSON to CSV
JSON to CSV
Flatten a JSON array into CSV. Nested objects become dotted columns, sparse records still line up, and cells containing delimiters are quoted.
Converted output appears here as you type.
Good to know
- Arrays of plain values share one cell, joined with "; ".
About this tool
CSV is what spreadsheets and most analysis tools import, which makes this the conversion to reach for when an API response has to go to someone who works in Excel, Numbers, or Sheets. It is also the most lossy conversion on this site, because a tree does not fit in a grid without decisions being made for you.
Those decisions: a nested object becomes dotted columns, so address.zipCode is a header rather than a structure. Records missing a field still line up under the right headers instead of shifting left. An array of plain values shares one cell, joined with ; , because there is no column to spread it across. The union of every record's keys becomes the header row, so a field present in only one record still gets a column.
Quoting follows RFC 4180 — any cell containing the delimiter, a quote, or a newline is wrapped, and an internal quote is doubled — with one addition aimed at spreadsheets rather than parsers.
- My JSON is a single object, not an array. Why the error?
- CSV rows are records, so the input has to be an array of them. Wrap a lone object in brackets for a one-row file. If your payload is
{"items": [...]}, convert the array itself rather than the wrapper. - Why is a cell starting with = or + quoted?
- Because Excel, Sheets, and Numbers treat a leading
=,+,-, or@as the start of a formula. Without the quotes, a value of-5becomes a calculation and=SUMbecomes an error in the cell. This is not a CSV rule — it is the difference between a file that parses and a file that opens correctly. - What happens to a deeply nested array of objects?
- It is flattened by index, with bracket notation:
projects[0].title,projects[1].title, and so on. Honest, but it means a record with twenty items produces twenty sets of columns — usually the signal that CSV is the wrong target for that payload. - Can I convert the result back?
- Structurally, no. Dotted headers do not rebuild into nested objects on the way back, and a cell holding
a; bis a string rather than an array. Treat CSV as a hand-off format, not a storage one.
Related tools
- CSV to JSONConvert CSV to a JSON array of objects. Quoted fields, escaped quotes, and embedded newlines are parsed correctly, and numbers and booleans are typed.
- TOML to JSONConvert TOML to formatted JSON. Tables, table arrays, dotted keys, inline tables, and multi-line arrays are all supported.
- JSON to TypeScriptGenerate TypeScript interfaces from a JSON sample. Fields missing from some records are marked optional, and values that are sometimes null widen to a null union.
Read the guide for the edge cases this converter cannot decide for you.