How to Unflatten JSON Keys
JSON Unflattening
When to Unflatten JSON
Restore hierarchical JSON from flat dot-notation keys produced by flattening tools, spreadsheets, environment variable loaders, or log pipelines.
Real-World Examples
{"user.name":"Ada","user.id":1} → nested {"user":{"name":"Ada","id":1}}
{"items[0].sku":"A1"} → array with object at index 0
Convert flat .env-style keys back to nested config objects
Common Mistakes
- Keys that conflict at the same path level (string vs object) cause merge errors
- Non-standard delimiters — this tool expects dots and bracket indices
- Pasting a nested JSON object instead of a flat key map
Developer Tips
- Validate flat keys were produced by the same flattening convention
- Format output after unflattening for readable config files
- Pair with Flatten to verify round-trip fidelity on sample data
Frequently asked questions
What input shape is expected?
A single JSON object with flat string keys using dot and bracket notation.
How are numeric path segments handled?
Bracket notation like items[0] creates arrays. Pure dot segments like user.name create nested objects.
Can I unflatten keys with dots in the original name?
Ambiguous keys may not round-trip perfectly. Prefer flatten/unflatten as a pair on the same dataset.