JSON Flatten
BetaFlatten nested JSON into a CSV whose columns are dot paths such as address.city. A data, results, items or records wrapper is found for you, arrays are joined or spread into columns, and on this page the JSON stays in your browser.
- Free, no sign-up
- REST + MCP
- Updated
- Reviewed by Olgun Ozoktas
On this page, the JSON is parsed and the CSV is built in your browser. Paste or drop a JSON array, a single object, or a wrapper such as {"data": [...]}. Nested keys become dot-path columns; null and a missing key are empty cells. For a big output, use Download rather than Copy.
The flat CSV, with one column per dot path, will appear here..
How to Flatten JSON to CSV
-
Add the JSON
Paste the JSON into the Nested JSON panel, upload a .json file, or drop it on the panel. The CSV appears as soon as the JSON parses. -
Check which rows were found
Read the status line under the panels. It says which shape was found: an array of objects, an array inside a wrapper such as data, or one object. If the array sits somewhere else, type its path in Array path, for example response.users or pages[0].rows. -
Choose how arrays are written
Choose how arrays are written. Join with | puts a list of plain values in one cell. JSON cell keeps every array as JSON text. Indexed columns spreads arrays into tags[0], tags[1] and lines[0].sku. -
Set the depth
Lower Depth if the columns go deeper than you need; anything below the limit stays as JSON text in its cell. -
Pick the separator and download
Pick the separator your spreadsheet expects, turn on Excel BOM if Excel on Windows shows accented letters wrongly, then download the CSV or copy it.
Common Use Cases
API responses in a spreadsheet
Nested exports to a report
Audit an API payload
Database and BI imports
Share with spreadsheet users
Why Use JSON Flatten?
Flattening JSON means writing every nested value under the path that leads to it. The object {"address":{"city":"London"}} becomes one key, address.city, with the value London. Do that for every record in an array, take the union of the keys as the header, and the result is a table with one column per path: the shape a spreadsheet, a CSV import or a BI tool can read.
This page reads one JSON document. A top-level array of objects gives one row per object. An object that wraps the array under data, results, items or records, or one level below one of them such as data.items, is unwrapped automatically, and the status line names the path it used. Any other location can be typed in Array path, with dots for keys and [0] or .0 for an array index. A single object with no such array becomes one row. Each row is flattened by run() from the json_flatten module, the same code the REST API and MCP tool call, with dots between keys.
Arrays have three modes. Join with |, the default, writes a list of plain values in one cell and keeps an array of objects as JSON text, with a note that counts those cells. JSON cell writes every array as JSON text. Indexed columns writes each position as its own column, tags[0] and tags[1], recursively. Depth caps how many dot segments a column name may have; a deeper value stays as JSON text. Quoting follows RFC 4180, so a cell that holds the separator, a quote or a line break is quoted. A leading byte order mark is ignored, and the page accepts up to 10 MB of JSON. JSON Lines files, with one object per line, are a different format: NDJSON to CSV flattens those.
How it compares
The JSON CSV Converter keeps each top-level key as one column and writes a nested value as JSON text in its cell, which is lossless but leaves the nesting for you to unpick. A jq filter or a pandas json_normalize call flattens properly, if those tools are installed and you know the syntax. This page is the flatten step on its own: dot-path columns, a wrapper found for you, a choice for arrays, and a column list to check before you download.
JSON Flatten Tips
- The header is the union of every flattened key across every row, in the order the keys first appear. A row without a key gets an empty cell there, and so does null.
- Join with | writes ["admin","beta"] as admin|beta. If your values can contain a pipe themselves, use JSON cell, which keeps the array exactly as JSON text.
- An array of objects, such as order lines, stays JSON text under Join with |. Indexed columns spreads it into lines[0].sku, lines[1].sku and so on, one column per position.
- An empty object produces no column. If a field is an empty object on every row, it does not appear in the CSV.
- Whole numbers above 9007199254740991 lose precision in any JavaScript JSON parser, this page included. If your IDs are that long, have the API send them as strings.