Skip to main content

Flatten Nested JSON

Flatten nested JSON into tabular data: choose the path separator and array handling, preview generated columns, then export to CSV or Excel.

  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Flatten nested JSON objects into explicit path columns so the result can be reused as tabular data.

Your files are processed locally in your browser and are never sent to our servers.

Drop your file here

Recommended size: up to 30 MB

Options

Was this tool useful?

How does this tool work?

Nested JSON often describes records with child objects, such as customer.address.city, and lists of tags or contacts. Flattening turns that structure into columns named after their paths so the values can be used in CSV or a spreadsheet. This tool preserves scalar values and offers two ways to handle nested arrays. It does not validate a business schema, select a JSONPath expression or create a separate row for every item in a nested list.

Import a JSON file up to 30 MiB. The root must be an object or array; a standalone scalar such as 42 or null is rejected. A root object creates one row. A root array creates one row per element: scalar elements go into a value column, while objects are flattened. Everything runs in your browser. Native JSON parsing applies: comments and trailing commas are invalid, very large integers may lose precision, and repeated object keys retain their last value before flattening.

Nested object keys are joined with the chosen separator, a dot by default. An address object containing city becomes address.city. Existing key names do not escape that separator. If a literal address.city key collides with the equivalent nested path, processing fails rather than overwriting either value. Choose a separator absent from the original keys or rename them first. Empty objects are retained as the text {} rather than silently disappearing from the resulting table.

By default, a nested array stays in one cell as JSON text, for example ["blue","green"]. Index mode instead creates columns ending in 0, 1 and so forth, also traversing objects at those positions. It does not explode arrays into rows or form Cartesian products between lists. Empty arrays remain the text [] in either mode. Numbers, booleans and null retain scalar types; missing properties appear empty in tabular exports. Inspect the preview and export CSV or XLSX.

How to use this tool

  1. Inspect roots and keys

    Review a sample for nested objects, arrays and separators already used in names. Check that each root-array element represents the intended record.

  2. Choose array handling

    Keep JSON mode to retain a list in one cell, or select index mode to compare positions. Neither option creates an extra row per nested item.

  3. Check the resulting table

    Inspect a nested path, an empty array and a missing property. Verify long numeric identifiers before export because precision lost during parsing cannot be recovered afterwards.

Use cases

Inspect an API export

Expose addresses and preferences as readable columns instead of copying nested paths manually.

Prepare an import table

Flatten child objects before converting data for a receiving system that accepts scalar cells only.

Compare fixed list positions

Expose short arrays by index when their positions have a consistent meaning across source records.

Examples

Keep a list in one record

Default dot separator and JSON array mode create customer.name and customer.city, while tags remains JSON text in one cell.

Input

{"customer":{"name":"Ada","city":"Leeds"},"tags":["pro","active"]}

Result

customer.name;customer.city;tags
Ada;Leeds;"[""pro"",""active""]"

Expose array positions

Dot separator and index mode expose scores.0 and scores.1. The empty array remains [] in a scores column.

Input

[{"id":1,"scores":[7,9]},{"id":2,"scores":[]}]

Result

id;scores.0;scores.1;scores
1;7;9;
2;;;[]

Tips and best practices

  • Choose a separator absent from existing keys. Dots make readable paths, but an explicit naming convention is safer than assuming the document never uses literal dots.
  • Store long identifiers as strings in the source JSON. JavaScript numbers have finite precision, and flattening cannot repair an integer already rounded during parsing.
  • Avoid index mode for very long lists unless every position is needed. Thousands of generated columns can be less practical than retaining the array’s JSON text.

Frequently asked questions

Does index mode create a row per array item?

No. It creates columns such as contacts.0.name and contacts.1.name in the same row. One row per contact requires a different transformation and an explicit identifier-repetition rule. Multiple nested arrays are not automatically combined with each other.

Why do key collisions stop processing?

A literal a.b key and an object a containing b produce the same dot-separated path. Choosing one would lose data. The engine reports the conflict instead; use another separator or rename the original keys to make their paths unambiguous.

How does this differ from CSV to JSON?

The CSV/JSON converter expects a flat table with scalar cells. Flattening prepares nested data for that purpose. Some arrays remain JSON text depending on the selected mode, and the table does not guarantee exact reconstruction of the original object.

Is every valid JSON document accepted?

The root must be an object or array using standard JSON syntax. Standalone scalar roots are rejected. Files are read into browser memory; the 30 MiB import limit does not guarantee comfortable handling of extremely deep structures or very wide generated tables.

Related tools

Tools similar or complementary to this one.

Similar tools

Convert Excel, CSV, and other spreadsheet formats directly in your browser.

Data & spreadsheetsFeaturedUse this tool

Generate SQL INSERT statements from Excel, CSV, or JSON.

Data & spreadsheetsUse this tool
GuideBest practicesBeginner

Split a CSV or Excel table into smaller files

Discover when to split a large table by row count or by a column value, and how to preserve a useful structure in every output file.

29 August 20261 min