Flatten nested JSON into a single-level object whose keys spell out the original path
(a.b, or a[0] for arrays), or unflatten a flat object back into
nested JSON. Handy for getting nested data into a spreadsheet, an analytics table, or
env-style config, and for reversing that process later. Pick a delimiter (.,
/, or _) and an array notation, and empty objects/arrays and
falsy values (null, false, 0, "") are
preserved rather than dropped. Looking to explore paths instead of converting between them?
Try JSON Path Finder. Other related tools:
JSON Formatter, JSON to CSV,
and JSON to Query String.
JSON Flattener / Unflattener
Flatten nested JSON to single-level path keys, or unflatten it back
Output will appear here...Frequently asked questions
What is JSON flattening used for?
Flattening turns nested JSON into a single-level object whose keys encode the original path (e.g. `{"a":{"b":1}}` becomes `{"a.b":1}`). That shape is easier to drop into a spreadsheet or CSV, load into flat analytics/logging pipelines that expect one row of scalar fields, or write out as env-style config (`SERVER_PORT=8080`) — anywhere a tool expects flat key-value pairs instead of arbitrary nesting.
What happens if a key in my JSON already contains the delimiter or brackets?
Flattening still succeeds, but a key like `"a.b"` (which already contains a literal dot) or `"a[0]"` (which already contains brackets) produces a warning instead of a silent surprise — the resulting flat key is ambiguous and might not unflatten back to the exact same shape. Switch the delimiter or array notation if your source keys collide with the default one.
Why does {"a.0": "x"} unflatten to an array instead of an object?
This is the classic gotcha of delimiter-style array notation: with "Delimiter a.0" selected, any path segment made entirely of digits is read back as an array index, so `{"a.0": "x"}` becomes `{"a": ["x"]}`, not `{"a": {"0": "x"}}`. If you need a literal numeric object key to survive a round trip, use "Brackets a[0]" mode instead — bracket indices are unambiguous.
Does flattening drop empty objects and arrays?
No — unlike some flatteners, this tool preserves `{}` and `[]` values exactly where they occur instead of silently dropping them, so a round trip through flatten then unflatten doesn't lose that information. `null`, `false`, `0`, and `""` are likewise kept as real values, not treated as empty.
Does my JSON leave my browser?
No. Both flattening and unflattening run entirely client-side in JavaScript — nothing is uploaded to a server, and there is no signup or account required.
Get weekly dev tools and tips