JSON Flatten / Unflatten
Convert nested JSON into dot-notation key-value pairs, or reverse.
What is Flatten?
The JSON Flatten/Unflatten tool converts nested JSON structures into flat dot-notation key-value pairs (flatten) or reverses the process (unflatten). Useful for environment variables, spreadsheet exports, or flat key-value stores.
How it works
We parse the JSON and recursively walk the tree. For flattening, nested keys are joined with a configurable delimiter. For arrays, you can choose index-based keys or preserve the array as-is. Unflattening reconstructs nested structure from dot-notation keys, auto-detecting arrays from bracket notation.
- Paste JSON. Paste nested JSON to flatten, or flat dot-notation JSON to unflatten.
- Choose mode. Toggle Flatten vs Unflatten. Configure delimiter and array handling.
- Copy or download. Copy the result to clipboard or download as .json.
Examples
Flatten nested
{ "user": { "name": "Alice" } } becomes { "user.name": "Alice" }.
Unflatten
{ "user.name": "Alice" } becomes { "user": { "name": "Alice" } }.
Common mistakes
Array handling
Indexed mode flattens arrays to key[0], key[1]. Preserve mode keeps them as JSON arrays.
Alternatives
JSON to CSV
For spreadsheet export instead of dot-notation JSON.
Frequently asked questions
Can it round-trip?
Yes — flatten then unflatten (with the same delimiter) should produce the original structure.
What delimiter should I use?
Dot (.) is standard for env-vars. Underscore (_) works for systems that don't allow dots.