JSON Unflattener
Reverse JSON flattening by converting dot-notation flat keys back into nested objects and arrays. Supports custom delimiters and automatic array detection from numeric keys.
Features
🔀 Reverse Flattening
- Converts dot-notation keys to nested objects
- Restores original JSON hierarchy
- Handles deeply nested structures
- Preserves all value types
📋 Array Detection
- Auto-detects numeric keys as array indices
- Reconstructs ordered arrays correctly
- Optional — can be disabled
- Works with mixed object/array structures
⚙️ Flexible Delimiters
- Dot (.) — most common default
- Underscore (_) — common in env vars
- Slash (/) — URL-path style keys
- Custom delimiter for any format
JSON Unflatten Guide
How Unflattening Works
Flat JSON uses dot-separated keys to represent hierarchy. This tool splits each key on the delimiter and rebuilds the nested structure.
// Input (flat)
{
"user.name": "Alice",
"user.age": 30,
"tags.0": "js",
"tags.1": "go"
}
// Output (nested)
{
"user": { "name": "Alice", "age": 30 },
"tags": ["js", "go"]
}
Where flat keys come from
Flat, dotted keys appear wherever a system can only store one level of key and value: environment variables, spreadsheets, form fields, analytics exports and key-value stores. Unflattening restores the nested structure your application expects.
Tips and common pitfalls
- Round trip safely with our JSON Flatten tool, using the same delimiter in both directions.
- If real key names contain dots, such as domain names, pick a different delimiter like
__or/. - Numeric segments such as
items.0.namecan become array indexes. Turn this off if those numbers are really IDs. - Check for conflicts:
aanda.bcannot both hold values, sinceacannot be a value and an object at once.
More questions
Can I unflatten a CSV export?
Yes. Convert the CSV to JSON with our CSV to JSON tool, then unflatten each record so dotted column names become nested objects.
Does the order of keys matter?
No. Keys can be in any order; paths are rebuilt from the key names alone.