The Nested JSON Flattener turns awkward, deeply nested JSON into a clean, one-level
map of dot-notation keys and their values — and reverses the process just as easily.
It is built for developers, data engineers, QA testers, and analysts who need to inspect a
payload, diff two API responses, build a flat config, or move JSON into a spreadsheet
without hand-editing brackets. Paste any object or array, and every leaf value gets a key
that spells out its full path, like order.customer.name or order.items.0.sku. Switch
to Unflatten and the same tool rebuilds the original nested structure from those flat
keys, so the conversion is a true round-trip rather than a one-way dump.
How it works
The flattener walks the entire JSON tree recursively. Each time it reaches a primitive
value — a string, number, boolean, or null — it records the joined path as a key. Objects
contribute their property names; arrays contribute their numeric index. You control two
things that matter for downstream tools: the delimiter that joins path segments (a dot
by default, but you can use a slash, underscore, or anything short), and the array
notation. Dotted indexes produce items.0.price; bracket notation produces
items[0].price. The Keep empty option decides whether empty objects and arrays are
preserved as explicit {} and [] leaf markers so the shape survives a round-trip.
Unflattening reverses all of this. It splits each key back into path segments, normalising bracket notation to indexes first, then walks down the structure creating objects or arrays as needed. A numeric token tells it to build an array; anything else builds an object. If every top-level key is numeric, the root itself collapses back into an array. Because the logic is symmetric, flattening then unflattening with the same settings returns exactly what you started with.
Example
Given an order object with a nested customer and a two-item array, flattening produces keys
such as order.id, order.customer.name, order.customer.tags.0, order.items.0.sku,
order.items.0.qty, and order.items.1.price. The summary line reports the number of leaf
keys and the maximum nesting depth, and the scrollable table previews every pair.
| Flat key | Value |
|---|---|
order.id | A-1007 |
order.paid | true |
order.customer.name | Ada Lovelace |
order.items.0.sku | BK-01 |
order.items.1.price | 3.2 |
Click Export flat CSV and those rows download as a quoted two-column spreadsheet ready for Excel, Google Sheets, or a database import — generated locally, with nothing ever leaving your browser.