JSON to CSV Converter

Convert JSON to CSV in the browser, flattening nested objects and handling the arrays and missing keys that have no natural representation in a flat table.

This conversion loses information, in four separate ways

JSON is a tree and CSV is a rectangle, so something has to give. That is unavoidable and the conversion is still worth doing — but it is worth knowing exactly what leaves, because none of it produces an error message.

1. Flattening is not reversible. Nested objects become dotted column names, which is readable and standard. It is also ambiguous, because a key is allowed to contain a dot:

JSONFlattens to
{"user":{"name":"Ada"}}{"user.name":"Ada"}
{"user.name":"Ada"}{"user.name":"Ada"}

Two different documents, one CSV. Nothing downstream can tell which it was, so a round trip out to CSV and back cannot be trusted to return what went in.

Arrays go ragged, and empties collapse

2. Arrays become one column per index, so the column set is the union across every record and most records do not fill it. Three records with one, three and zero tags:

RecordColumns it fills
{"id":1,"tags":["a"]} 2 of 4
{"id":2,"tags":["a","b","c"]} 4 of 4
{"id":3,"tags":[]} 1 of 4

4 columns — id, tags.0, tags.1, tags.2 — of which only 1 record fills them all. The rest are blank, and a blank cell does not mean "this record has no third tag"; it means nothing in particular, because the format has no way to say it.

3. Three JSON states become one empty cell. JSON distinguishes a key set to null, a key set to the empty string, and a key that is simply absent. CSV has one blank for all of them:

JSONMeaningCSV cell
{"a":null} Explicit null (empty)
{"a":""} Empty string (empty)
{} Key absent (empty)

This is the loss that most often matters, because the distinction people actually care about — "we know the answer is nothing" against "we never asked" — is exactly the one that disappears. Zero and false survive fine, as 0 and false; it is specifically the three empty states that merge.

4. The column order is your decision. JSON objects carry no meaningful key order, and records need not share keys at all. Given records with keys in different orders, two reasonable rules give two different files:

RuleColumn order
First seenb, a, c
Alphabeticala, b, c

Same columns, same data, different file, and neither is more correct. Worth choosing deliberately rather than inheriting: a diff between two exports is useless if the column order drifts because one record happened to arrive with its keys in a different order.

None of this is an argument against the conversion — CSV opens in a spreadsheet and JSON does not, and that is often the whole point. It is an argument against treating the CSV as the record of truth afterwards. Keep the JSON.

How to use

  1. Paste your JSON array of objects.
  2. Review how nested fields have been flattened.
  3. Check that every expected column appears.
  4. Download or copy the CSV.

Frequently asked questions

What kind of JSON converts cleanly to CSV?

An array of flat objects with consistent keys — that maps directly onto rows and columns. Anything deeply nested, or with arrays inside records, has no single correct flat representation and has to be flattened by convention.

How are nested objects handled?

By flattening the path into the column name, so a nested address with a city field becomes a column called address.city. This is readable and reversible, though it produces long headers on deeply nested data.

What happens to arrays inside a record?

There is no good answer, only trade-offs. The options are to join the values into one cell with a separator, to spread them across numbered columns, or to explode the record into several rows. Each loses something — respectively structure, consistent column count, or the one-row-per-record relationship.

What if records have different keys?

The output needs the union of all keys as columns, with blanks where a record lacks one. The alternative — using only the first record's keys — silently drops data, which is worse and unfortunately common.

Do I need to worry about commas in the data?

The converter handles it by quoting any field containing a comma, quote or line break, and doubling internal quotes. This is the standard CSV convention, and it is why the output sometimes has quotes that were not in your input.

Why does Excel mangle my output?

Usually encoding or locale. Excel may need a byte-order mark to recognise UTF-8, and in locales using the comma as a decimal separator it expects semicolons instead. It also aggressively converts anything resembling a date or a number, which is what turns product codes into dates.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.