Flatten / Unflatten JSON
Turn nested JSON into dotted keys (a.b[0].c) and back.
Flatten / Unflatten JSON
Turn nested JSON into dotted keys (a.b[0].c) and back.
Watch: how to use the Flatten / Unflatten JSON (14 seconds)
Recorded on a phone, steps written on screen, no sound.
About the Flatten / Unflatten JSON
Turn nested JSON into flat dotted keys like a.b[0].c, or turn dotted keys back into nested JSON. Handy for spreadsheets, translations and config diffs.
Flatten and unflatten
Flattening turns nested JSON into one level with dotted paths: {"user":{"name":"Ali"}} becomes {"user.name":"Ali"}, and list items use brackets, such as tags[0]. Empty objects and lists are kept as values.
Unflattening does the opposite and rebuilds the nesting from the paths; a number in brackets makes a list. Flat JSON is easier to put into a spreadsheet, a translation file or an environment-variable list.
How to use the Flatten / Unflatten JSON
- Enter your textType or paste JSON.
- Pick the optionsaction (the defaults suit most uses).
- Press Run toolThe result appears right under the button.
- Copy or download the resultCopy text results with Copy output; when the tool makes a picture or file, use its Download button.
This tool works inside your browser: what you enter stays on your device.
Example
A sample input and the result the Flatten / Unflatten JSON gives for it (produced by the tool itself, not typed by hand).
- JSON
- {"name": "Kitwise", "tools": 3, "tags": ["pdf", "image", "text"], "free": true}
- Action
- Flatten
Result:
{
"name": "Kitwise",
"tools": 3,
"tags[0]": "pdf",
"tags[1]": "image",
"tags[2]": "text",
"free": true
}Good to know
- What you need
- You type or choose: JSON
- Where it runs
- In your browser, on your device.
- Cost
- Free, no sign-up.
Questions
Are arrays supported?
Yes, as [0], [1]…
Is the round trip exact?
Flatten then unflatten gives the same structure.