JSON to CSV
Convert a JSON array of objects into CSV.
Overview
The JSON-to-CSV converter flattens a JSON array of objects into a CSV with one row per object. Headers come from the union of all keys across objects so partial records don't lose their data, and nested objects can be flattened with dotted column names.
It's the reverse trip of CSV-to-JSON, useful when an API returns a list of records you want to open in a spreadsheet, share with a non-technical colleague, or load into a database via bulk import. Developers and analysts use a json to csv converter to skip writing transformation code for a one-off export.
How it works
The input must be a JSON array; bare objects are rejected to keep the operation unambiguous. The converter scans every element to build the master header list — keys are emitted in first-seen order across the array. Nested object values can be either JSON-stringified into one cell or flattened into dotted columns (address.city, address.country).
Arrays nested inside objects can be joined with a configurable delimiter (tags="admin;ops") or left as JSON literals if structure matters. CSV output follows RFC 4180: cells with commas, quotes, or newlines are quoted, and embedded quotes are doubled.
Examples
Input:
[
{ "id": 1, "name": "Alice", "tags": ["admin","ops"] },
{ "id": 2, "name": "Bob", "tags": ["dev"] }
]
Output (tags joined):
id,name,tags
1,Alice,"admin;ops"
2,Bob,dev
Input with nested object:
[ { "user": { "first": "Alice", "last": "Liddell" } } ]
Output (flattened):
user.first,user.last
Alice,Liddell
FAQ
What if objects have different sets of keys?
The union of all keys becomes the header row. Missing cells in any row are emitted as empty strings, which is the right default for spreadsheet consumers.
Can I get NDJSON converted to CSV?
Yes — the NDJSON formatter can convert your input to a single JSON array first, then run it through this converter. Or paste an NDJSON-shaped array directly (wrapped in [/] with commas between objects).
Are dates kept as ISO strings?
Yes — strings stay as strings, including ISO timestamps. CSV has no native date type, so the consumer decides how to interpret the values.