JSON to CSV Converter

First data row—
Data rows—
Columns—

How JSON to CSV Converter is calculated: Headers = the union of keys in first-appearance order; nested values are JSON-stringified; values with commas, quotes, or newlines are quoted.

What is a JSON to CSV converter?

JSON is the format programs speak: arrays of objects with named keys. CSV is the format spreadsheets speak: rows of values separated by commas. When data starts as JSON — an API response, an export, a test fixture — and the destination is a spreadsheet, something has to translate, and that is what this converter does.

The translation is straightforward. The keys of the objects become the header row, and each object becomes one CSV row, with its values in the same order as the headers. The default text on this page, two objects with name and age, becomes three lines: name,age on the first, then Ada,36 and Grace,40.

The tricky part is quoting, and this converter handles it properly. A value that contains a comma, a quote, or a newline is wrapped in double quotes, and quotes inside it are doubled. That is the CSV rule, and it is what keeps a value like "lives in London, UK" in one column instead of splitting in two.

Everything runs in your browser. Your data never leaves your device, nothing is uploaded or stored, and there is no account to create. You can convert sensitive records — customer lists, private exports, internal data — without worrying about who else sees them.

How JSON becomes CSV

The converter parses your JSON first. If the input is invalid, it reports the error instead of guessing — a broken block cannot become a clean spreadsheet. A single object is wrapped into a one-item array automatically, so {"name":"Ada"} converts just as well as a list of objects.

Then it collects the headers: every key that appears in any object, in the order it first appears. That union matters, because real data is ragged — one object may have a key the others lack. The header row covers all of them, so no value is ever dropped for want of a column.

Each object becomes one row, with its values placed under the matching headers. A missing key becomes an empty cell, which is honest: the data was not there. A null becomes an empty cell too, and a boolean or number prints as itself — true, 36, exactly as written.

Nested values — an object or an array inside a value — are written as JSON text inside the cell. {"tags":["dev","uk"]} becomes the cell text ["dev","uk"], quoted because it contains commas and quotes. The data survives the trip, and a spreadsheet can still open the file.

The quoting rules, in plain language

A value is quoted when it needs to be. If it contains a comma, a double quote, or a newline, the converter wraps it in double quotes. If it contains none of those, it is written plain. That is the standard CSV rule, and it keeps the output readable — most cells stay unquoted, and only the tricky ones get quotes.

A quote inside a quoted value is doubled. A value like say "hello" becomes "say ""hello""" — the outer quotes mark the field, and each inner quote is written twice. That is the only way to put a quote inside a quoted field, and every spreadsheet reads it back correctly.

A nested value is always quoted, because its JSON text contains commas and quotes by nature. The tags ["dev","uk"] become the cell "[""dev"",""uk""]" — which looks messy on the page but reads back exactly in a spreadsheet. The mess is the price of keeping the data intact.

An empty cell means missing data. A key that an object does not have, and a null value, both print as nothing between the commas. That is the honest reading: the value was not there. Do not read an empty cell as zero or as false — it means absent.

A worked example: people, nesting, and a single object

Start with the default text: two objects, name and age each. The converter produces two rows and two columns, and the first data row is Ada,36. The header row is name,age, and the second row is Grace,40. Three lines, and the whole table is there.

Now a nested value: one object with a name, a tags array, and a city object. The result is one row and three columns, and the first data row is Ada,"[""dev"",""uk""]","{""name"":""London""}". The array and the object both became JSON text inside quoted cells, and the commas inside them stayed inside their cells.

Try a single object instead of an array: {"name":"Ada","age":36}. The converter wraps it into a one-item array and produces one row and two columns, with the first data row Ada,36. You do not have to add the brackets yourself — the tool accepts the object as it stands.

Finally, try broken input: [{"a":1},]. The converter reports invalid JSON with the error at character 8, the comma after the closing brace. There is no honest way to convert a block that does not parse, so the tool refuses and points at the problem.

Who converts JSON to CSV, and why

Developers are the biggest users. Data starts as JSON — an API response, a database export, a test fixture — and has to reach a spreadsheet for a colleague, a client, or an analyst. Converting once, at the boundary, is far easier than teaching every person to read JSON.

Data analysts are the second group. They receive JSON exports and need to open them in a spreadsheet to sort, filter, and chart them. A converter does the translation in seconds, without a script in between and without retyping anything.

Testers are a third group. They build test data as JSON because it is easy to write in bulk, then need CSV versions to feed into a tool that only accepts spreadsheets. Converting by hand is slow and error-prone; pasting the block here and copying the result takes seconds.

Students are a fourth group. Comparing the same data as JSON and CSV side by side is the fastest way to understand both formats. The converter shows the mapping in action: keys to headers, objects to rows, nested values to quoted cells — and the differences between the two formats become obvious.

JSON to CSV vs CSV to JSON

The two directions are mirror images, and they are both needed. Use this converter when the data starts as JSON — an API response, an export, a fixture — and the destination is a spreadsheet. Use the reverse converter when the data arrives as CSV and the destination needs JSON.

The rules are the same in both directions, which is why the pair works as a round trip. Quoted fields survive the trip in both directions, numbers stay numbers, and the header row maps to keys and back. Convert JSON to CSV and back again, and you get the same table — with the same values in the same columns.

Reading the input first is good practice. A JSON formatter prints your JSON neatly so you can read it before converting, and a sort lines pass can order the raw text if it helps. Read the data, then convert it — the converter is the second step, not the first.

Checking the result is another job. A character counter tells you how big the CSV is, and a text formatter cleans up plain text that came out of a document. Convert first, then check the result — in that order.

Common conversion mistakes

The most common mistake is expecting nested data to flatten itself. A value like {"city":{"name":"London"}} becomes one quoted cell containing JSON text — it does not split into separate city and name columns. If you need flat columns, flatten the JSON first, or accept the quoted cell and parse it in the spreadsheet.

Second: ragged objects. When one object has a key the others lack, the header row still covers it, and the objects without it get empty cells. That is correct, but it surprises people who expected every row to be full. Check the header row first — it tells you which keys exist anywhere in the data.

Third: numbers that must stay text. A postcode like 01234 becomes the number 1234 in JSON, and the leading zero is already gone before the converter sees it. If a value must keep its leading zero, it must be a string in the JSON — "01234" with quotes — before you convert.

Fourth: converting broken JSON and expecting the tool to fix it. A converter cannot repair a missing quote or a trailing comma. If the tool reports invalid JSON, fix the error it points to and convert again. The error message is the help, not the obstacle.

How to use this JSON to CSV converter

Using this converter is simple. Paste your JSON array into the box, or type it directly — a single object works too, and the tool wraps it for you. The CSV appears instantly in the box below, with the first data row, the row count, and the column count shown above it. There is no button to press and no form to submit.

To use the result, select the text in the output box and copy it into a file with a .csv ending, or paste it straight into a spreadsheet. To convert another block, select all, delete, and paste the new one — the counts reset instantly. If the JSON is invalid, the output box shows the error instead.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — your JSON never leaves your device. It works offline once the page has loaded, so you can use it on a plane, in a server room with no signal, or anywhere else you move data between formats.

Try it with something real before you need it: paste a small JSON array from an API you use and open the CSV in a spreadsheet. Once you have used it twice, the mapping — keys to headers, objects to rows — becomes second nature, and the JSON-to-spreadsheet gap stops being a chore.

Frequently Asked Questions

They are written as JSON text inside the cell, and the cell is quoted because that text contains commas and quotes. A tags value of ["dev","uk"] becomes the cell "[""dev"",""uk""]". The data survives the trip intact, and a spreadsheet can still open the file. If you need flat columns instead, flatten the JSON before converting.

The header row is the union of every key that appears in any object, in the order each key first appears. Objects that lack a key get an empty cell in that column. No value is ever dropped for want of a column, and no row is ever padded with invented data.

Yes. A single object like {"name":"Ada","age":36} is wrapped into a one-item array automatically, and converts to one data row. You do not have to add the square brackets yourself. An empty array is rejected, because there are no keys to build headers from.

Yes. Everything runs in your browser — your JSON is never uploaded, stored, or sent anywhere. You can convert sensitive records like customer lists or private exports without worrying about who sees it, and the page works offline once it has loaded.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.