Search DevTools

Jump to any tool or page

JSON to CSV

Turn an array of JSON objects into CSV. Columns are collected from every row, so uneven objects still convert cleanly.

JSON

an array of objects

CSV

The CSV appears here as you type.

Data Transformation

About JSON to CSV

Turn a JSON array of objects into CSV, flattening nested structures into dot-notation columns along the way. The genuinely hard problem is that JSON is a tree and CSV is a rectangle: arrays of varying length, heterogeneous records, and nested objects all need a lossy decision, and the interesting question is which one the converter makes.

Frequently asked questions

How are nested objects and arrays flattened into columns?
Nested objects flatten by path, so {"user":{"name":"Ada"}} becomes a column headed user.name. Arrays are the awkward case, because their length varies per record and CSV columns cannot. Two strategies exist: index into positional columns (tags.0, tags.1) which yields a ragged, sparse header, or serialise the array back to a JSON string inside a single cell, which keeps the shape stable but requires the consumer to parse it again. Neither round-trips perfectly.
What determines the column order and set when records differ?
The header must be the union of every key across the whole array, which means the converter has to read all records before writing the first line — you cannot stream a truly heterogeneous array in one pass. Records missing a key produce an empty cell, not a shifted row. This is why a large export can appear to hang before producing output, and why a single unusual record near the end can add a column that is empty for every other row.
Why does my CSV break Excel when a field contains a comma or newline?
RFC 4180 handles this by quoting: a field containing a comma, a double quote, or a line break is wrapped in double quotes, and any literal quote inside is doubled. So He said "hi", ok becomes "He said ""hi"", ok". Embedded newlines stay inside the quoted field and remain valid CSV, though naive line-splitting parsers will still mangle them. If a downstream tool chokes, the usual culprit is a parser that splits on newline before honouring quotes.
Why do long IDs turn into scientific notation when I open the file?
That is Excel, not the CSV. CSV has no types — every field is text — so Excel guesses on open, and any long digit string is guessed to be a number and rendered as 1.23457E+18, with digits beyond the fifteenth silently discarded. Leading zeros vanish for the same reason. Prefixing values with a tab or an apostrophe is a common hack, but it corrupts the file for every non-Excel consumer. Importing via Data, From Text with explicit column types is the clean fix.
How are null, undefined, and boolean values represented?
CSV has no null. A JSON null usually becomes an empty field, which makes it indistinguishable from an empty string — a real information loss if your data treats those differently. Booleans are written as the bare words true and false, which most consumers read as text rather than logical values. Keys whose value is undefined never appear in JSON at all, so they contribute nothing to the union header unless another record supplies the same key.