How JSON becomes CSV rows and columns
CSV is flat and JSON isn't. The useful question is where to cut, and the answer depends on your data, so you see the cut before you download it.
- One table per array. Every array of objects becomes a table, named after its key. A file with orders and customers gives you two CSVs, not one tangled one.
- Nested objects become columns.
{"usage": {"input_tokens": 764}}becomes a column called "Usage · Input tokens". - Nested arrays become child tables. They aren't crammed into a cell as text; you drill into them row by row.
- A top-level array works too. A file that is just
[{…}, {…}]is one table, and so is a JSON Lines file.