Devbelt

JSON to CSV

Convert a JSON array to CSV, flattened for spreadsheets

JSON
CSV
CSV output appears here.
Paste a JSON array of objects to convert it to CSV.

Everything runs in your browser. Your JSON is never uploaded or stored on a server.

About

You've got a JSON array from an API or an export, and you need it in a spreadsheet. Paste it here and each object becomes a row, with the keys as column headers. The part most converters get wrong is nested data: they dump a whole nested object into one cell as a JSON blob. This one flattens it instead, so address.city and address.zip come out as their own columns. Pick your delimiter, copy or download, and none of it leaves your browser.

What it does

A CSV is rows of values with a header line on top, which is what spreadsheets and most data tools expect. JSON is nested and hierarchical, so getting from one to the other means flattening that structure into a flat grid. This tool takes a JSON array of objects, turns each object into a row, and uses the keys as the column headers.

If your objects don't all have the same keys, that's fine. The converter looks at every object, collects all the keys it finds, and lines them up as columns. Where a row is missing one of them, that cell is just left empty.

How nested data is handled

Real API responses are rarely flat. When an object holds another object, the converter walks into it and joins the keys with a dot, so {"address": {"city": "London"}} turns into a column named address.city. That's the useful part, because a nested object crammed into a single cell as JSON is painful to work with in a spreadsheet.

Arrays are a different story, since a single cell can't really hold a list. An array value gets written as its JSON text inside the cell. And if you'd rather keep nested objects whole instead of splitting them into dotted columns, turn Flatten off and they'll be written as JSON too.

{ "name": "Ada", "address": { "city": "London" } }

name,address.city
Ada,London

Delimiters and escaping

Comma is the default, but you can switch to semicolon, tab, or pipe. Semicolon is worth knowing about, because spreadsheet software in a lot of European locales expects it instead of a comma. Tab gives you TSV, which pastes straight into a spreadsheet cleanly. Pipe is handy when your data itself is full of commas.

Whatever delimiter you pick, the converter follows the standard CSV escaping rules. If a value contains the delimiter, a quote, or a line break, it gets wrapped in double quotes, and any quotes inside it are doubled. That's what stops a value like "Smith, John" from being read as two separate columns.

Wrapped arrays and where the data goes

A lot of APIs don't hand you a bare array. They wrap it, like {"users": [ ... ]}. When the converter sees a single array of objects sitting inside an object like that, it pulls it out automatically and tells you which key it used, so you don't have to reshape the JSON first.

All of this happens in your browser with JavaScript. The JSON you paste is never sent to a server, which matters when you're converting a real export with real people's data in it.

Frequently asked questions

How do I convert JSON to CSV?
Paste a JSON array of objects into the input box. Each object becomes a row and each key becomes a column, and the CSV appears instantly on the right. From there you can copy it or download it as a file.
How are nested objects and arrays handled?
By default, nested objects are flattened into dotted columns, so address.city becomes its own column. Arrays are written as JSON text inside a single cell, since a cell can't hold a list. Turn off Flatten to keep nested objects as JSON instead of splitting them.
What if my objects have different keys?
That works fine. The converter collects every key across all the objects and uses them all as columns, leaving a cell empty wherever a particular row doesn't have that field.
Can I change the delimiter?
Yes. You can pick comma, semicolon, tab, or pipe. Semicolon suits spreadsheet software in many European locales, tab gives you TSV that pastes straight into a sheet, and pipe helps when your data is full of commas.
My JSON is wrapped in an object like {"data": [...]}. Will it work?
Yes. When there's a single array of objects inside a wrapper object, the converter finds it and converts that array. The status bar shows which key it used.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser. Your JSON is never sent to or stored on a server.

Related tools