Overview
Flattens an array of JSON objects into CSV with auto-detected headers. Nested objects are flattened into dotted column names like address.city, missing keys become empty cells, and values containing commas, quotes, or newlines are quoted and escaped per CSV convention. The conversion runs live as you type, with copy and download buttons for the result.
How It Works
Paste a JSON array into the left panel; the CSV appears on the right immediately, and a Convert button re-runs it manually if needed. A single JSON object is accepted too and treated as a one-row table. The header row is the union of all keys found across every flattened row, so objects with different shapes still produce one consistent table. Errors, such as invalid JSON or an empty array, are shown as a red message under the input, and the output panel offers Copy and Download to save the file as data.csv.
Step-by-Step Usage Guide
- Paste a JSON array (or a single object) into the input panel.
- Check the header row: nested keys appear as dotted names like address.city.
- Adjust rows so that optional fields do not shift the columns unexpectedly.
- Copy the CSV or download it as data.csv.
Technical Specifications & Standards
Two design decisions shape the output. First, flattening: each row's nested objects are walked recursively and their leaves become columns joined by dots, so a nested name field becomes the column user.name; arrays are not flattened but stringified, so an array of strings joins into a comma-containing cell that the escaper then quotes, and an array of objects becomes its JSON-ish string form, which is readable but not structured. Second, header discovery: the columns are the union of keys across all rows rather than the first row's keys, so a field that only appears in row five still gets a column, and rows lacking it get an empty cell, which is the correct sparse-table behavior for heterogeneous records. The escaper follows the standard quoting rule: a value is wrapped in double quotes only if it contains a comma, a double quote, or a newline, with internal quotes doubled, which round-trips through strict parsers. Nulls and undefined values become empty cells rather than the strings null or undefined. What to watch: column order follows first-seen order across rows, so inserting a new field early in the data shifts columns; and the tool does not offer the reverse direction, so for CSV back to JSON use the CSV tools elsewhere on the site.
Targeted Use Cases
- Exporting an API response array to a spreadsheet for analysis.
- Flattening nested records into the flat shape a database importer expects.
- Producing CSV fixtures from JSON test data with consistent union headers.
- Sharing tabular data with non-technical teammates without writing conversion code.
Notes & Gotchas
- Flatten or rename deeply nested fields before converting if you want shorter column names.
- Expect arrays to arrive as quoted comma-joined strings; restructure them into separate rows if you need one value per cell.
- Keep key order stable across rows when the CSV will be diffed, since columns follow first-seen order.
- Treat null as an empty cell in the output, not the text null, and adjust downstream parsers accordingly.
Frequently Asked Questions
How are nested objects handled?
They are flattened recursively with dotted column names: a nested city field becomes an address.city column. Arrays are not flattened; they are stringified into a single quoted cell.
What if rows have different fields?
The header row is the union of all keys found in every row. A field present in only some rows still gets a column, and rows without it are given empty cells.
Are values with commas or quotes escaped correctly?
Yes. Any value containing a comma, double quote, or newline is wrapped in double quotes with internal quotes doubled, which is the standard CSV quoting convention that strict parsers expect.
Can I convert CSV back to JSON here?
No. This tool is one-directional from JSON to CSV. For the reverse, use the site's CSV-to-JSON converter or the CSV table editor.