Rebuild nested JSON from flat keys
Runs locallyRebuild nested objects and arrays from dot-notation keys.
JSON input
Result
Paste JSON on the left — the result appears here automatically.
About rebuilding nested JSON
How it works in 4 steps · 4 common use cases · 3 questions answered
About rebuilding nested JSON
How it works in 4 steps · 4 common use cases · 3 questions answered
How it works
- 1.Paste a flat object whose keys are dot-notation paths, such as user.address.city.
- 2.Bracketed indexes like tags[0] are read as array positions rather than key names.
- 3.The nested objects and arrays those paths describe are rebuilt.
- 4.Copy the structured result.
Common use cases
- •Rebuilding a config object from flat environment-variable style keys
- •Turning a spreadsheet or CSV row with dotted headers back into a nested payload
- •Reversing a flatten step after diffing or editing the flat form
- •Constructing a nested request body from a flat form submission
FAQ
Is this the exact inverse of the flattener?
Yes, for documents whose key names contain no dots. Flatten then unflatten returns the original document.
What decides whether a path segment becomes an object or an array?
The notation. A bracketed number creates an array position; anything else creates an object key. So items[0].id builds an array of objects, while items.0.id builds nested objects.
What happens if two keys conflict?
If one path treats a segment as a value and another treats the same segment as a parent, the structure is contradictory and the conflict is reported rather than silently resolved.