About this tool
Unflattening is the reverse of flattening: it takes an object whose keys are paths and rebuilds the nested structure. {"user.name": "Ada", "user.address.city": "London"} becomes {"user": {"name": "Ada", "address": {"city": "London"}}}. It’s useful for turning spreadsheet rows, form fields, environment variables and translation files back into proper JSON.
How it works
- Each key is split on the separator, and objects are created for every level.
- With Numeric keys → Become arrays, a level whose keys are exactly
0, 1, 2…becomes an array. Gaps are filled withnull. Choose Stay object keys if you have objects keyed by numbers, such as years or HTTP status codes. - With Read [0] as an array index on, bracket paths such as
items[0].skuwork too, so output from lodash, JavaScript or form libraries can be mixed with dot paths. - A top-level array of flat objects (for example rows from a CSV) is unflattened item by item.
Conflicting keys
Some flat objects can’t be unflattened, such as {"a": 1, "a.b": 2}: a can’t be both the number 1 and an object containing b. The tool stops and names the conflicting keys instead of silently dropping a value. An explicit empty value ("a": {}) next to "a.b" is fine and merges.
Example: form fields to JSON
{ "shipping.name": "Ada", "shipping.lines[0]": "12 St James's Sq", "shipping.lines[1]": "London" }
→ { "shipping": { "name": "Ada", "lines": ["12 St James's Sq", "London"] } }
Coming from CSV? CSV to JSON can nest dotted column names directly.
FAQ
How do I convert flat JSON keys to nested JSON?
Paste the flat object and choose the separator used in the keys (a dot by default). Each key is split into levels and the nested structure is rebuilt.
How are arrays rebuilt?
Levels whose keys are 0, 1, 2… become arrays, and bracket indexes like items[0] are read as array positions. You can turn this off to keep numeric keys as object keys.
What happens with a key like "a" and "a.b" in the same object?
That is a conflict: a cannot be a value and an object at once. The tool reports both keys instead of dropping one.
Can I unflatten a list of rows?
Yes. Paste an array of flat objects and each one is unflattened separately.
Is unflatten the exact reverse of flatten?
Yes, when the same separator is used and no key contains the separator itself.