JSON Unflatten
Rebuild nested JSON from flat dot-notation keys — turn a config map or key/value list back into a proper object tree, arrays restored.
Flat keys back to structure
Unflattening reads a flat object of dotted keys and rebuilds the nested tree they describe. Each dot starts a new level; a numeric segment (0, 1, …) creates an array rather than an object. It is the exact inverse of JSON Flatten.
{
"user.name": "Ada",
"user.roles.0": "admin",
"user.roles.1": "dev"
}
{ "user": { "name": "Ada", "roles": ["admin", "dev"] } }Typical inputs
Flat key/value data shows up everywhere: .properties and .env-style configuration, form submissions serialized as address[city]-ish keys, analytics payloads, and message catalogs. Unflattening turns that back into a shape your code can traverse with normal property access.
How arrays are detected
A key segment made only of digits becomes an array index: items.0.sku builds items as an array whose first element is an object with sku. If your real keys are numeric strings that should stay object keys, that is the one ambiguity of the flat form — rare in practice. Inspect the rebuilt structure in the tree viewer if unsure.
Frequently asked questions
How does it decide between an array and an object?
By the key segment: purely numeric segments (0, 1, 2 …) become array indices; anything else becomes an object key. So items.0.name builds an array of objects, while items.a.name builds nested objects.
What if array indices have gaps?
Missing indices become null holes in the array (standard JSON.stringify behaviour). If you flattened with the tool on this site, indices are contiguous and there are no gaps.
Can I use a different separator than the dot?
This tool splits on dots, matching the flatten output. For bracket-style keys (a[b][0]) convert them to dot form first, or use a library configured for your delimiter.
Is it the exact inverse of flatten?
Yes for standard data: flatten then unflatten (or vice-versa) returns the original document, arrays included. The only edge case is original keys that literally contain dots.