Convert nested JSON into a flat, single-level object whose keys are the full paths (for example user.address.city). Useful for spreadsheets, CSV export, log pipelines and diffing.
Show calculation steps
Processed privately in your browser β nothing you paste is uploaded, logged or stored.
What flattening does
Nested JSON is convenient for programs and awkward for almost everything else β spreadsheets, CSV exports, diff views and log pipelines all want flat fields. Flattening rewrites the document as a single-level object whose keys spell out the full path to each value, so {"user":{"address":{"city":"Pune"}}} becomes {"user.address.city":"Pune"}. Values and their types are untouched; only the nesting is unrolled.
Worked example
Input:
{
"user": { "name": "Asha", "address": { "city": "Pune", "pin": "411001" } },
"tags": ["admin", "editor"],
"active": true
}Output with the default settings (dot delimiter, bracket indexes):
{
"user.name": "Asha",
"user.address.city": "Pune",
"user.address.pin": "411001",
"tags[0]": "admin",
"tags[1]": "editor",
"active": true
}When to use it
- Turning API responses into rows for Excel or Google Sheets β flat keys map cleanly onto columns.
- Diffing two configurations: flat documents diff line by line instead of block by block.
- Feeding log and analytics pipelines that expect dotted field names.
- Producing a complete inventory of every leaf value with its address, before a migration or audit.
Limitations to know
- If an original key contains the delimiter character itself (a key literally named
"a.b"), the flattened path becomes ambiguous β the tool warns you, and switching to the slash or underscore delimiter usually resolves it. - Empty objects
{}and empty arrays[]are kept as leaf values rather than silently vanishing, so a round trip preserves them. - Numbers longer than 15 digits lose precision in any JavaScript tool, this one included β keep long IDs as strings.
Common errors and fixes
- “The input must be a JSON object or array” β a bare string or number has nothing to flatten; wrap your data in an object or array.
- Keys look wrong in my CSV pipeline β some tools expect
tags.0rather thantags[0]; switch the array-index option to “Delimited”. - Round trip does not reproduce the original β check the delimiter-collision warning; a key containing the delimiter needs a different delimiter choice before flattening.
To rebuild the nested structure afterwards, use the JSON Unflattener; to turn the flat rows into a table, continue to the JSON to Markdown Table converter.
How to use the JSON Flattener
- Paste your nested JSON into the input panel (or click "Load sample").
- Pick the key delimiter and how array indexes should be written β brackets like a[0].b, or delimited like a.0.b.
- Click "Flatten JSON".
- Copy the flat result or download it as a .json file.
Frequently asked questions
What does flattening JSON mean?
Flattening converts nested objects and arrays into a single-level object whose keys are the full paths to each value β user.address.city instead of three levels of nesting. Every value keeps its type; only the structure changes.
What do keys like tags[0] mean?
The bracket number is the array index: tags[0] is the first element of the tags array. If you prefer delimiter style, switch the array option to get tags.0 instead β some pipelines (like certain CSV tools) expect that form.
Can I reverse the flattening?
Yes β the JSON Unflattener rebuilds the nested structure from the flat keys. One caveat: if an original key itself contains the delimiter character (a key literally named "a.b"), the flat path is ambiguous and a round trip cannot restore it; this tool warns you when that happens.
Why would I flatten JSON?
Typical reasons: preparing nested API data for spreadsheets or CSV export, diffing two configs line by line, mapping fields into log or analytics pipelines, and listing every leaf value with its full path for auditing.