Boneyard Tools

JSON to CSV examples

Common JSON shapes and the exact CSV they produce, including heterogeneous rows, nested data and custom delimiters.

Array of objects

The most common and best-behaved shape is an array of flat objects. Each object becomes one row, and each unique key across the whole array becomes a column header. Because the header is the union of all keys, you can mix records that carry slightly different fields and still get a single tidy table. This is exactly the shape most REST APIs return for a list endpoint, which is why it converts so cleanly.

Rows that do not share every key

Real data is rarely uniform. When one object has a 'role' field and another does not, the converter still lists 'role' as a column and leaves an empty cell wherever the value is missing. The order of columns follows the order keys first appear, so the most complete object near the top of the array gives you a predictable header. Nothing is discarded and no row shifts out of alignment.

Nested values

When a value is itself an object or array, it is serialized to JSON text and placed in the cell. Because that text contains commas and quotes, the whole cell is quoted and its inner quotes are doubled, for example the array of a and b becomes a single quoted field. The CSV stays rectangular and valid, and you can parse that cell back into JSON later if you need the structure again.

Choosing a delimiter

Comma is the default and the safest choice for most tools. If your values themselves contain commas, a tab or semicolon delimiter can make the raw file easier to scan, and some European spreadsheet locales expect a semicolon. Pipe is handy when data may contain both commas and tabs. Whichever you pick, any value containing that delimiter is still quoted so the columns never break apart.

Frequently asked questions

Does Excel open the result?

Yes. Save the output as a .csv file and open it in Excel, Google Sheets or Numbers. The first row becomes your headers.

Can I convert the CSV back to JSON?

Yes. A flat CSV round-trips cleanly through a CSV to JSON converter, though nested cells come back as JSON strings you can parse a second time.