JSON Flatten and Unflatten
Flatten nested JSON into dot keys like user.address.city, or turn flat keys back into nested JSON.
Add JSON and click the button to see the result here.
How JSON Flatten and Unflatten works
Flatten turns nested JSON into one object with a single level of keys. Each key is the full path to a value, like user.address.city. This helps when you need to load JSON into a spreadsheet, a database or a settings file.
Unflatten does the reverse. It takes flat keys and builds the nested JSON again. Pick the mode, the separator and how list positions are written.
Input to JSON Flatten and Unflatten
- Paste or type JSON into the input box, or upload a .json or .txt file.
- For Unflatten, the input must be one object with flat keys, like {"user.name": "Ann"}.
- Separator can be a dot, an underscore, a slash or a double underscore. Lists can be written as tags.0 or tags[0].
Output from JSON Flatten and Unflatten
- Flatten gives one object with path keys. Empty objects and arrays are kept as {} and [].
- Unflatten gives nested objects and arrays. Missing list positions are filled with null.
- Change any option and the output updates right away. Download the result as flat.json or nested.json.