JSON flattener and unflattener
About JSON Flattener
This JSON flattener online tool collapses nested JSON into a single-level object with dot-notation keys like "plan.tier" and "roles[0]". Flat keys are easier to diff, export to a spreadsheet or store as key-value pairs.
Swap the direction to unflatten. Give it a flat object of dot-and-bracket paths and it rebuilds the nested objects and arrays. Runs in your browser. Nothing is uploaded.
How it works
Dot paths and bracket indices
Object keys are joined with dots (plan.tier) and array elements use bracket indices (roles[0]). The brackets let the unflattener tell an array index from an object key, so arrays come back as arrays.
Empty objects and arrays are kept
An empty {} or [] has no leaf values, so it is stored as a value at its own path. Empty containers survive the round trip.
Unflatten rebuilds the structure
In unflatten mode, numeric bracket segments become array positions and dotted segments become object keys. The output is the original nested document.
Pretty-printed both ways
Both directions output JSON with two-space indentation. Strings, numbers, booleans and null are kept as they are. Only the shape of the keys changes.
Frequently asked questions
What is flattened JSON?
Flattened JSON is a single-level object where each key is the full path to a value in the nested original, for example "plan.tier": "pro" and "roles[0]": "admin". It holds the same data as a flat map of paths and values.
How to flatten nested JSON to dot notation?
Paste your nested JSON. The tool walks every branch, joins object keys with dots and writes array indices in brackets, and outputs a single-level object as you type.
Can I unflatten it back to nested JSON?
Yes. Use the swap control to switch to unflatten mode and paste a flat object of path keys. Flatten and unflatten are exact inverses for well-formed input.
What happens to keys that already contain a dot?
The dot is the path separator, so a key with a dot in its name is read as two path segments. Unflattening splits it into nested keys. If your keys contain literal dots, the round trip is not safe for those keys.
Is my data uploaded anywhere?
No. Flattening and unflattening run in your browser, and the tool works offline.
Sources & last verified
We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.
Found a wrong result or an outdated claim? Report an error and we will check it again.