About this tool
Flatten nested JSON into dot-notation keys and rebuild the nested structure, with bracket or dot array styles.
This tool flattens nested JSON into a single-level object of dot-notation paths — user.address.city or users[0].name — and rebuilds the nested structure from those paths, in either direction. It supports both common conventions: lodash-style bracket indices ([0]) and flat-package-style dot indices (.0), keeps empty objects and arrays as leaves so round-trips are lossless, and treats conflicting paths as errors rather than silent overwrites. It is built for developers preparing JSON for CSV export, diffing deeply nested API responses, or authoring config as flat key lists.
Open JSON Flatten Unflatten Tool on AltFTool — it loads instantly in your browser.
Paste or upload your source content.
Choose the target format or conversion mode.
Copy or download the converted result.
Bracket indices (users[0].name, lodash-compatible) or dot indices (users.0.name, flat-package style).
Empty {} and [] are preserved as leaf values, so flatten then unflatten returns the original document.
a = 1 next to a.b = 2 fails with the offending path instead of silently discarding data.
Flattening converts a nested document into a single-level object whose keys are the full paths to each leaf value, so {"user":{"name":"Ada"}} becomes {"user.name":"Ada"}. Every scalar keeps exactly one row, which makes the data trivial to diff, grep, or map onto CSV columns.
Two conventions exist and this tool supports both: bracket style writes users[0].name, matching lodash get/set paths, while dot style writes users.0.name, matching the npm flat package. Pick the style your downstream tool expects — and note that in dot style an object key that is purely numeric will be rebuilt as an array index.
Because two keys claim the same location with incompatible shapes — for example a = 1 alongside a.b = 2, or a[0] alongside a.b, which force a to be a scalar, an object and an array at once. The tool names the conflicting path so you can fix the key; silently picking a winner would corrupt the output.
They make the flat form ambiguous: {"a.b": 1} and {"a": {"b": 1}} both flatten to the path a.b. The tool flattens them anyway but warns you, because unflattening will always rebuild the nested interpretation — if exact round-trips matter, rename such keys first.
Add the JSON Flatten Unflatten Toolwidget to your blog or website — free, responsive, no signup. Just keep the “Widget by AltFTool” credit link visible.
<iframe src="https://www.altftool.com/embed/widget/json-flatten-unflatten-tool"
title="JSON Flatten Unflatten Tool — free AltFTool widget"
width="100%" height="640" style="border:0;border-radius:12px;overflow:hidden"
loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p style="font-size:12px;margin:4px 0 0">Widget by <a href="https://www.altftool.com/tools/all/json-flatten-unflatten-tool?utm_source=embed&utm_medium=widget">AltFTool — free online tools</a></p>