RunTheTests
/

JSON to CSV Converter

Flatten a JSON array into CSV, dotted keys and all.

What you paste

Parsed in your browser — never uploaded

How this reads your output

A top-level array is used directly, and an object containing exactly one array is unwrapped, which is how most APIs wrap a collection. Each record is then flattened so nested objects become dotted column names, and the union of every key across every record becomes the header. That union matters: records with different shapes are common in JSON and impossible in CSV, so missing fields become blank cells and the count is reported.

What the results mean

Flattened from nested objects
How many columns came from nesting. A key written as user.city means the value was inside a user object.
Records missing some fields
Records that did not carry every key. Those cells are blank, which CSV cannot distinguish from a field that was present and empty.
Columns
The union of keys across all records, so a field appearing in only one record still gets a column.

Common problems and fixes

Long identifiers are mangled after opening in a spreadsheet
The spreadsheet converted them to numbers. Anything over fifteen digits loses precision and anything with leading zeros loses them, which quietly damages order numbers, product codes and phone numbers. Use the import dialogue and mark those columns as text rather than double-clicking the file.
Arrays come out as JSON inside a cell
That is deliberate for arrays of objects, because the alternative is a column for every index and a header that changes with the data. If you need those expanded, extract the nested array on its own and convert it separately, joining back on an identifier.

Frequently asked questions

What happens to null values?

They become empty cells, which is the only representation CSV has. That means null, an empty string and a missing field all look identical in the output, so if the distinction matters, the conversion loses it.

Can it handle newline-delimited JSON?

Not directly. Wrap the lines in square brackets with commas between them to make it a valid array first. Line-delimited JSON is common in log pipelines and is a different format despite the similar name.

Does column order match the JSON?

Columns appear in the order keys were first encountered across the records. JSON objects have no guaranteed order in principle, though every implementation in practice preserves insertion order, so the result is usually what you would expect.

Put this on your own site

Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.

Embed code
<iframe src="https://runthetests.com/embed/json-to-csv/" width="100%" height="720" style="border:1px solid #e5e5e5;border-radius:8px" title="JSON to CSV Converter" loading="lazy"></iframe>

Preview it at https://runthetests.com/embed/json-to-csv/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.

More in DevTools