JSON to CSV Converter
Convert JSON arrays or objects into CSV with flattened object keys.
Convert JSON arrays or objects into CSV with flattened object keys.
JSON and CSV disagree about shape and that disagreement is the whole story of this conversion.
JSON is a tree. A record can contain another record, which can contain a list, which can contain more records, nested as deep as you like. CSV is a grid. Rows and columns, nothing inside a cell but a value.
So converting JSON to CSV means flattening the tree until it fits the grid. This tool converts JSON arrays or objects into CSV with flattened object keys. There is a sample dataset on the page with a Sample button if you want to see the output shape before using your own data.
A nested object becomes extra columns with joined names. If a record holds a user object containing a name and an email, you get columns like user.name and user.email rather than a single user column. No data is lost and the row count stays the same.
This handles the common case well, because most JSON from an API nests objects a level or two deep and nothing more.
Arrays inside records are the hard part and no converter solves this cleanly, because the problem is genuinely unsolvable in CSV.
If one record holds a list of three tags and the next holds seven, there is no correct number of columns. Every tool picks a compromise: join the values into one cell, create numbered columns sized to the longest list or repeat the row once per item. Each choice is wrong for somebody.
This tool takes the first option. A list inside a record is written into a single cell as JSON text, for example ["red","blue"], so no values are lost and every row keeps the same columns. Nested objects become dotted column names such as address.city. If you need one row per list item, expand the list before converting.
The conversion works best when your JSON is an array of objects where every object has the same keys. That maps onto rows and columns exactly.
If your file is a single object wrapping the real data, which is very common with API responses, the useful part is usually one level down under a key like data, items or results. Pull that array out before converting, otherwise you get a one row CSV describing the wrapper rather than the records inside it.
If objects have inconsistent keys, columns appear for every key found and records missing that key get empty cells. That is normally what you want, but it can produce a wide sparse file if the data is irregular.
Two things catch people out when the CSV reaches a spreadsheet.
Long numeric strings such as IDs, phone numbers and postal codes get reformatted by Excel into scientific notation or have leading zeros stripped. Import the file rather than double clicking it and set those columns to text during import.
Non English characters can appear as nonsense if the file is opened with the wrong encoding. Importing with UTF-8 selected fixes it.
Neither is a fault in the conversion. Both happen when the spreadsheet guesses.
This sits alongside the other developer and data tools on the site. For file conversions rather than data conversions, see the image and document tools, including Images to PDF and PDF to JPG.
They are flattened into extra columns with joined key names, so a nested user object becomes columns such as user.name and user.email.
This tool writes each list into a single cell as JSON text, such as ["red","blue"]. No values are lost and the column count stays fixed. If you need one row per item, split the list out before converting.
Because the top level object is one record. The data you want is usually an array nested under a key such as data or results. Extract that array and convert it instead.
Excel guesses column types and turns long digit strings into scientific notation. Import the CSV rather than opening it directly and set those columns to text.
An encoding mismatch when opening the file. Import with UTF-8 selected.
The tool runs in your browser, so the data stays on your device. That matters here more than for most conversions, since JSON exports frequently contain personal data.