JSON Flattener
Flatten nested JSON to dot-notation keys, or unflatten back to nested form. 100% local.
Flattening and the Dot-Notation Format
Flattening collapses a nested JSON object into a single-level object where each key describes the full path to its value. A nested object like {"user": {"name": "Alice"}} becomes {"user.name": "Alice"} — the dot separates each level of nesting.
Common uses include: environment variable systems (most do not support nested objects natively), CSS-in-JS design token files that expect flat key maps, diff-friendly config files where one value per line is easier to review, and APIs that only accept flat query parameters or form bodies.
{
"user": {
"id": 1,
"name": "Alice",
"address": {
"city": "London",
"country": "UK"
}
},
"config": {
"theme": "dark",
"language": "en"
}
}{
"user.id": 1,
"user.name": "Alice",
"user.address.city": "London",
"user.address.country": "UK",
"config.theme": "dark",
"config.language": "en"
}Separator Options
The separator character is inserted between path segments. Choose the one that fits your target system.
| Separator | Example key | Use when |
|---|---|---|
| . (dot) | user.address.city | Most readable; standard for most tools and libraries |
| _ (underscore) | user_address_city | When keys already contain dots; AWS Parameter Store |
| / (slash) | user/address/city | File-path style; HashiCorp Vault, Consul, some CLIs |
"user.id" with the dot separator — flattening will create an ambiguous path that cannot be correctly unflattened back to the original structure. Choose a separator that does not appear in any of your existing key names.How Arrays Are Handled
Array elements become indexed path segments using the same separator. For example, {"tags": ["a", "b"]} flattens to {"tags.0": "a", "tags.1": "b"}. Round-tripping arrays through flatten → unflatten works correctly — the numeric indices are recognized and the array is reconstructed in order.
Try It
Frequently Asked Questions
Your files stay on your computer. Dad promised.