JSON to CSV Converter

Turn a JSON array into a CSV file you can open in a spreadsheet: the header is the union of every key, cells are quoted and escaped, and nested values become JSON text.

When a list of API results has to go to someone who lives in a spreadsheet, JSON is not usable and CSV is. This page builds the table for you: the header row is collected from every key that appears in any row, a value that is missing from one row becomes an empty cell instead of dropping a column, and each value is quoted and escaped according to the CSV rules so commas and quotes inside a field survive the trip.

The conversion happens in the browser and nothing is uploaded, which matters for exports containing order numbers or customer records. Be aware of the format limit before you rely on it: CSV is a flat, two-dimensional table, so nested objects and arrays are serialized into a single cell as JSON text. The data is still there, but it cannot be sorted, filtered or pivoted until you flatten it.

Headers, rows and how the JSON is read

The header is the union of the keys across all rows, ordered by first appearance, so a key that only some rows carry becomes a column with empty cells rather than disappearing. All values are wrapped in double quotes, and an inner quote is written twice as "" per the CSV specification. If the root is an array, its elements are the rows. If the root is an object, the first array-valued property is used as the rows and its sibling keys are ignored — the usual cause of a column that seems to be missing. An object without any array property is exported as a single row, a root that is a number or a string is rejected with an error, and an empty array produces empty output. The delimiter is a comma and cannot be changed.

Nested data and the two-dimensional limit

A nested object or an array is written into its cell as one line of JSON, braces and all, with its quotes doubled for CSV. Nothing is dropped, but the column no longer means anything: in a spreadsheet you see a text blob that cannot be filtered or pivoted, and a deeply nested value can run into the character limit a cell allows. Real analysis needs a flat shape, so promote the nested field to a column of its own before converting, or export only the top-level fields you actually need.

Reading CSV back into JSON

The reverse direction parses the first row as the header by default; clear the First row is a header toggle to get col1, col2 and so on instead. Parsing is quote-aware, so commas, line breaks and doubled quotes inside a field are handled correctly instead of splitting the row. Empty cells become null. Type inference is deliberately conservative to avoid corrupting identifiers: values with leading zeros such as 007 or ZIP code 010, integers beyond the safe range, and notations such as 1e5 or 1.2.3 all stay strings, while plain whole and decimal numbers become JSON numbers and true / false become booleans. Rows with fewer columns than the header get null for the missing ones, extra columns are ignored, and duplicate header names are suffixed _2, _3 so later columns do not overwrite earlier ones.

Advertisement

Frequently asked questions

Where did my nested objects and arrays go?
Into a single cell, as JSON text. CSV cannot represent nesting, so the converter serializes the value instead of losing it; the cost is that the cell is opaque to sorting, filtering and pivot tables, and very large nested values can exceed a spreadsheet cell limit. Flatten the JSON first if the nested fields need to be usable as columns.
How are null, an empty string and a missing field distinguished?
They are not — all three are written as an empty cell, and reading the file back turns an empty cell into null. If the difference matters downstream, encode it before converting: replace null with a marker string such as "NULL", or add a column that records whether the field was present. A whole column disappearing usually means the root was an object whose array property was chosen as the rows, leaving its sibling keys out.
Why does a ZIP code or order number come back as a string instead of a number?
That is deliberate. The CSV parser only converts plain decimal values without leading zeros and within the safe integer range; 007, 010, 19-digit IDs, 1e5 and 1.2.3 are all left as strings so an identifier is never silently rewritten. If you genuinely need a number, strip the leading zeros after parsing.
Excel shows garbled characters when I open the exported file — what should I do?
The file is UTF-8 without a byte order mark, and some Windows versions of Excel assume a local codepage instead. Use Data → From Text/CSV and choose UTF-8 as the encoding, or import it once and save as a BOM-marked CSV that opens correctly afterwards. The same file is fine in Google Sheets, LibreOffice and code editors.

Related tools

Advertisement