How to Use the JSON to CSV Converter
- Paste a JSON array of objects (e.g. [{"a":1},{"a":2,"b":3}]).
- Click Convert to CSV — the header is the union of all keys.
- Check the Rows / Columns counters to confirm shape.
- Copy the CSV or click Download to save it as a .csv file.
JSON arrays of objects map cleanly to CSV: each object is a row, each unique key is a column. The tricky parts are deciding the header order when objects have different keys, and quoting fields that contain commas, double-quotes or newlines without breaking downstream parsers. This converter takes the union of keys in first-seen order and applies RFC 4180 quoting (a field with any of , " \n is wrapped in quotes; internal " becomes "").
How the JSON to CSV Converter Works
Nested objects and arrays are JSON-stringified into a single cell, because CSV itself is intentionally flat — there is no spec for nested data. That output is round-trippable: you can JSON.parse the cell later if you need the structure back. Conversion happens entirely in the browser, with row and column counts shown alongside the output so you can sanity-check shape before importing into a spreadsheet.
- Headers are the union of all object keys — missing fields become empty cells
- RFC 4180 quoting handles commas, quotes and newlines without breaking Excel imports
- Nested objects/arrays are JSON-stringified so structure round-trips
- Row / column counters show the resulting shape before you export
Frequently Asked Questions
What if some objects in the array have extra keys?
The header row is the union of every key seen across the array, so missing fields just become empty cells. The order of the headers follows first-appearance order, which is usually what you want for diffs.
How are commas, quotes and newlines inside a value handled?
Per RFC 4180: any field containing a comma, double-quote or newline is wrapped in double-quotes, and any internal double-quote is escaped by doubling it (" becomes ""). That is the form Excel, Google Sheets and Postgres COPY all expect.
What happens to nested objects or arrays?
They are JSON-stringified into a single cell. CSV is intentionally flat, so nested structure is preserved as text — you can re-parse it later with JSON.parse if needed.
Does it support a top-level object instead of an array?
Yes. A single object is treated as a one-row array. If you have objects keyed by id, you may want to map them to an array first ([…Object.values(map)]) so the keys become a column.
Explore the full suite of DATA FORMATS tools and 290+ other free utilities at Chunky Munster.