About this tool
Most JSON from an API is not flat. A customer record has an address object inside it, a product has a list of tags, and an export often wraps the records in something like {"data": [...]}. A spreadsheet, on the other hand, wants one row per record and one plain value per cell. This converter bridges the two: it finds the array of records, flattens nested objects into dot-notation columns such as address.city, lets you decide how arrays should look, and writes CSV with correct quoting. Everything runs in your browser, so the JSON never leaves your device.
How to use the JSON to CSV Converter
- Paste your JSON. An array of objects is the usual input, but a single object or an object that wraps an array also works.
- Pick a delimiter. Comma is standard. Choose semicolon if your copy of Excel uses a comma as the decimal separator, or tab for pasting into a spreadsheet.
- Choose how arrays are written: as JSON text in a single cell, or spread across indexed columns like
tags.0andtags.1. - Click Convert to CSV. The status line shows the number of rows and columns, and the preview table shows the first 20 rows.
- Copy or download the result. Tick the UTF-8 BOM option before downloading if the file is going straight into Excel.
What input shapes are accepted
- An array of objects becomes one row per object.
- An object that contains an array, such as
{"meta": {...}, "results": [...]}: with "Use the first array inside an object" ticked, the converter searches the object level by level, uses the first array it finds, and names its path in the status line (for exampleresultsordata.items). Untick the option to turn the whole object into a single row instead. - A single object with no array inside becomes one row.
- An array of plain values such as
[1, 2, 3]becomes a single column namedvalue, and an array of arrays becomes columns named0,1,2and so on.
How flattening and the header work
With flattening on, each nested object adds its key to the column name with a dot, so {"address": {"city": "London"}} becomes a column called address.city, and deeper nesting simply adds more dots. With flattening off, a nested object is written into one cell as compact JSON text.
Arrays have two modes. JSON text in one cell keeps the column count stable: ["math", "poetry"] becomes the cell ["math","poetry"]. Indexed columns give each element its own column, tags.0, tags.1, and objects inside arrays are flattened too, giving names like items.0.sku. An empty array or object adds no column of its own.
Records rarely all have the same keys, so the header is the union of every key in the order each one is first seen. A record that lacks a column simply gets an empty cell there. JSON null is also written as an empty cell, while true, false and numbers are written as text.
Quoting rules (RFC 4180)
CSV has no single official standard, but RFC 4180 documents the common format, and this tool follows it. A field is wrapped in double quotes only when it contains the delimiter, a double quote, a carriage return or a line feed. A double quote inside a quoted field is escaped by doubling it, so Said "hi" is written as "Said ""hi""". RFC 4180 uses CRLF line breaks between records, which is the default here; untick "CRLF line endings" to use a bare LF instead.
Worked example
The sample loaded in the tool has three records. Record 2 has no email or active key but adds notes; record 3 has an empty tags array and a comma in its name. With the default settings (comma, arrays as JSON text, flattening on) the output is:
id,name,email,address.city,address.zip,tags,active,notes 1,Ada Lovelace,ada@example.com,London,W1,"[""math"",""poetry""]",true, 2,Grace Hopper,,New York,,"[""navy""]",,"Said ""ask forgiveness"", then shipped" 3,"Smith, John",,Austin,,[],false,
The header has eight columns, in first-seen order, with notes last because it first appears in record 2. Grace Hopper's null zip and missing email are empty cells. Smith, John is quoted because it contains the delimiter, and the array cells are quoted because the JSON text contains double quotes, which are doubled. Switch arrays to indexed columns and the tags column is replaced by tags.0 and tags.1.
Opening the file in Excel
Microsoft's support article on opening CSV UTF-8 files in Excel says a UTF-8 CSV opens normally if it was saved with a BOM (byte order mark). If your data has accented letters, emoji or non-Latin text, tick the BOM option before downloading. The BOM is added only to the downloaded file, not to the copied text. When the tab delimiter is selected, the download is named data.tsv.
Common mistakes
- Pasting JavaScript instead of JSON. Single quotes, unquoted keys and trailing commas are not valid JSON. Run the text through the JSON Formatter to find the exact error.
- Choosing indexed columns for long arrays. If one record has 50 tags, every row gets 50 tag columns. JSON text in one cell is usually tidier.
- Expecting large IDs to survive. JSON is parsed with JavaScript numbers, so integers above 9,007,199,254,740,991 lose precision. Store long IDs as strings in the source JSON.
- Assuming spreadsheet-safe values. The converter writes values exactly as they are. A cell starting with
=,+,-or@may be read as a formula by a spreadsheet; see OWASP on CSV injection before sharing files built from untrusted data.
Common use cases
- Turning an API response into a spreadsheet for a report or a quick pivot table
- Exporting records from a NoSQL database for colleagues who work in Excel
- Loading JSON test data into a tool that only imports CSV
Going the other way? The CSV to JSON Converter turns a spreadsheet export back into JSON, and the Markdown Table Generator makes a table for a README.
Frequently asked questions
Open the JSON file in any text editor, copy its contents and paste them into the input box. The conversion runs with JavaScript in your browser, so nothing is sent to a server. Then click Download .csv to save the result as a file on your computer.
Not inside the tool; every key found in the records becomes a column. The quickest way to drop or reorder columns is to open the downloaded CSV in a spreadsheet and delete or drag the columns you do not need, then save it again as CSV.
That usually means Excel read a UTF-8 file with a different encoding. Tick Add UTF-8 BOM to download and download the file again. Microsoft also describes importing the file through Data, Get Data, From Text/CSV, which reads UTF-8 files without a BOM.
Not directly, because JSON Lines is not a single JSON value. Wrap the lines in square brackets and put a comma at the end of every line except the last. The text then becomes a normal JSON array of objects that the converter accepts.
There is no fixed limit, since the work happens in your own browser. Files of a few megabytes convert quickly on a typical computer. Very large files depend on available memory; the preview only draws the first 20 rows, which keeps the page responsive.
CSV has no data types, so every value is written as text, for example 42 or 3.5. Spreadsheets then decide how to read each cell. Values such as ZIP codes stored as JSON strings keep their leading zeros in the file, though a spreadsheet may drop them when it opens it.