CalculatorsConvertersDeveloperTextAll toolsDirectory
Submit your tool Sign in
Theme
Home/Answers/Data
How-to

How do I flatten a nested JSON object?

Short answer

Paste your JSON into a browser-based JSON flatten tool and it collapses the nested structure into a single level of dot-notation keys, so a.b.c points at the deeply nested value. The flattening runs on your device, which makes deep JSON far easier to diff, search or load into a flat store like a spreadsheet or a key-value config.

What dot notation does for you

A deeply nested JSON object hides its values inside layers of braces. Flattening rewrites it as a flat map where each key is the full path to a value, joined by dots, so user.address.city becomes a single key. Array indices are folded into the path the same way. The data is unchanged, but every value now has one clear address, which is exactly what many flat systems and comparisons need.

Where a flat map helps

Flattening is a quiet workhorse for a few jobs: diffing two configs so a change deep in the tree shows up as one differing key rather than a whole restructured block, loading nested data into a spreadsheet or an environment-style store that only understands flat keys, and scanning a large document for a specific path. Because the tool runs client-side, you can flatten real config or API data without any of it being uploaded.

Step by step

  1. Paste the JSON. Paste the nested JSON object into the flatten tool.
  2. Flatten locally. The tool collapses it into dot-notation keys in your browser.
  3. Copy the result. Copy the flat key-value map for diffing, storage or a spreadsheet.

Frequently asked questions

What does the flattened output look like?

A single level of keys where each key is the full dot-separated path to a value, such as user.address.city.

How are arrays handled?

Array positions become part of the key path using their index, so a list item gets its own flat key.

Is my JSON uploaded?

No. The flattening runs entirely in your browser.

Related answers