How to use JSON Flatten / Unflatten
- Paste a nested JSON document (to flatten) or a flat key/value object (to unflatten).
- Pick the delimiter and array index style.
- Click Flatten or Unflatten and copy the output.
JSON Flatten / Unflatten features
- Flattens nested objects and arrays into single-level path keys
- Choice of delimiter (., /, _, __, :) and dot or bracket array indexes
- Preserves empty objects and arrays
- Unflattens path keys back into nested structures
- Detects conflicting keys that cannot be nested
- Statistics on key count and path depth
JSON Flatten / Unflatten example
Flatten a user record
Input:
{"user":{"name":"Layla","roles":["admin","editor"]},"active":true}Output:
{
"user.name": "Layla",
"user.roles.0": "admin",
"user.roles.1": "editor",
"active": true
}Frequently asked questions about JSON Flatten / Unflatten
What does flattening produce?
A single-level object whose keys are full paths, for example user.address.city or user.roles.0. Empty objects and arrays are preserved as {} and [] so no information is lost.
Can I get bracket-style array paths?
Yes — choose "Brackets" to output user.roles[0] instead of user.roles.0. Both styles are understood when unflattening.
When would I use a different delimiter?
Use "__" or ":" when your keys already contain dots (domain names, version numbers) so paths stay unambiguous, or "/" to mimic pointer-style keys.
Why does unflatten fail with a "conflict" error?
Two keys describe incompatible structures, e.g. "a": 1 and "a.b": 2 — "a" cannot be both a number and an object. Remove or rename one of them.