Skip to content

Convert

JSON Flatten

JSON Flatten

Beta

Flatten 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.

Use via API
  • 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.

Nested JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Flat CSV

The flat CSV, with one column per dot path, will appear here..

How to Flatten JSON to CSV

  1. 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.
  2. 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.
  3. 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.
  4. Set the depth

    Lower Depth if the columns go deeper than you need; anything below the limit stays as JSON text in its cell.
  5. 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

Open an API response in Excel or Google Sheets with address.city and address.zip as real columns.

Nested exports to a report

Turn a CRM, Stripe-style or GitHub API export with nested objects into a report-ready table.

Audit an API payload

Check which nested fields an API really returns: the column list shows every dot path across all records.

Database and BI imports

Prepare nested JSON for a database or BI import that only reads flat CSV.

Share with spreadsheet users

Share a JSON payload with someone who works in a spreadsheet and not in jq.

Why Use JSON Flatten?

API responses nest their data: a user carries an address object, an order carries a customer and a list of lines. A spreadsheet wants one value per cell, so address.city and address.zip have to become columns of their own. The JSON to CSV converter keeps a nested object as JSON text in one cell on purpose, and the usual way out is a jq filter or a short script. This page does the flatten step in one paste: it finds the array of records, even inside a data or results wrapper, writes every nested key as a dot-path column, unions the columns across rows, and gives you an RFC 4180 CSV to download. Each row is flattened by run() from the json_flatten module, the code behind the REST API and the MCP tool, so a nested object gets the same dot-path name on the page and over the API.

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.

Frequently Asked Questions

What does JSON Flatten do?

JSON Flatten turns nested JSON into a flat CSV in which every nested key becomes its own column, named by its dot path. A record such as {"id":1,"address":{"city":"London"}} becomes the columns id and address.city. Paste or drop the JSON, and the CSV appears as soon as it parses, ready to copy or download.

How is JSON Flatten different from JSON to CSV?

The JSON CSV Converter writes a nested object or array as JSON text in one cell, while JSON Flatten spreads it into dot-path columns. Use the converter when one column per top-level key is what you want, and JSON Flatten when the spreadsheet needs address.city and address.zip as separate columns.

Which part of my JSON becomes the rows?

A top-level array gives one row per object. If the top level is an object, the array under data, results, items or records is used, or one level below them, such as data.items. Anywhere else, type the path in Array path, for example response.users or pages[0].rows. A single object with no such array becomes one row.

How are arrays written?

Join with |, the default, writes a list of plain values in one cell, so ["admin","beta"] becomes admin|beta, and keeps an array of objects as JSON text. JSON cell writes every array as JSON text. Indexed columns spreads arrays into columns such as tags[0], tags[1] and lines[0].sku. No mode turns array items into extra rows.

What does the Depth setting do?

Depth limits how many dot segments a column name may have. With 2 levels, address.city becomes a column but address.geo.lat stays inside an address.geo column as JSON text. All levels, the default, flattens everything.

What happens to null, missing keys and empty objects?

null and a missing key both write an empty cell, because CSV has no null. The header is the union of every key in every row, in the order the keys first appear, so a key that only one row has still gets a column. An empty object produces no column, and under Join with | an empty array is an empty cell.

Can I flatten JSON Lines (NDJSON or .jsonl)?

Not on this page. JSON Lines holds one object per line and is not one JSON document, so it fails to parse here. NDJSON to CSV reads that format and flattens each line with the same dot paths. When a paste looks like JSON Lines, the error message links there.

Can I turn the flat CSV back into nested JSON?

Not on this page. The json_unflatten REST API and MCP tool rebuild nested JSON from a flat key map such as {"address.city":"London"}. A CSV that has been through a spreadsheet can lose the value types and the column names a full round trip needs, so this page does not promise one.

Is my JSON uploaded?

On this page, no. The JSON is parsed and the CSV is built in your browser, and the page sends no request with your data; you can confirm that in the network panel while converting. The REST API and MCP tool are a separate path: a call sends the input you include to FindUtils over HTTPS, where it is processed and the result returned. FindUtils does not store that input, and logs the request without its content.

Is there an API for flattening JSON?

Yes, for the flattening step. The json_flatten REST API and MCP tool take one JSON object and return a flat key map with the same dot paths for nested objects. By default the REST API writes an array position as items.0 and the MCP tool as items[0], the form this page uses. They do not write CSV: finding the array, the array modes, the depth limit and the CSV itself are on this page.

How large a JSON file can I flatten?

The page accepts up to 10 MB of JSON. The work runs in your tab, so a file near the cap can keep the browser busy for a moment. When the CSV has more than 2,000 lines, the output panel shows the first 200, and Copy and Download still use the whole CSV.

Will the CSV open correctly in Excel or Google Sheets?

Yes. Google Sheets and Numbers read the UTF-8 file as it is. Excel on Windows can show accented letters wrongly in a plain UTF-8 CSV; turn on Excel BOM before you download. If your Excel expects semicolons, choose the semicolon separator.

Rate This Tool

0/1000

Get Weekly Tools

Suggest a Tool