JSON Flattener & Unflattener
About JSON Flattener
The JSON flattener collapses a nested JSON document into a single-level object whose keys are dot-notation paths, like "plan.tier" and "roles[0]". It is the fastest way to turn deeply nested data into a flat map you can diff, feed into a spreadsheet, or store as key/value pairs.
It runs entirely in your browser — nothing you paste is uploaded, logged or sent to a server, so flattening a real production payload is completely private. It is free, instant and needs no account.
Flip the direction and it unflattens: given a flat object of dot-and-bracket paths it rebuilds the original nested objects and arrays. The two directions are exact inverses, so you can round-trip a document out to a flat form and back without losing structure.
How it works
Dot paths and bracket indices
Object keys are joined with dots (plan.tier) and array elements use bracket indices (roles[0]). Using brackets for arrays rather than dots is what lets the unflattener tell an array index apart from an object key, so the reverse operation reconstructs arrays correctly.
Empty objects and arrays are preserved
An empty object {} or empty array [] has no leaf values to flatten, so it is kept as a value at its own path. This means empty containers survive the round trip instead of silently disappearing when you unflatten.
Unflatten rebuilds the structure
The swap control flips to unflatten mode: paste a flat object of path keys and it rebuilds the nested objects and arrays. Numeric bracket segments become array positions and dotted segments become object keys, reproducing the original document.
Pretty-printed both ways
Both directions output pretty-printed JSON with two-space indentation, so the result is readable and ready to copy. Values — strings, numbers, booleans and null — are preserved exactly; 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 original nested document, for example "plan.tier": "pro" and "roles[0]": "admin". It represents the same data as a flat map of path/value pairs, which is easier to diff, export to CSV, or store as key/value settings.
How to flatten nested JSON to dot notation?
Paste your nested JSON and the tool walks every branch, joining object keys with dots and indexing array elements with brackets, producing a single-level object. It happens instantly in your browser as you type — nothing is uploaded.
Can I unflatten it back to nested JSON?
Yes. Use the swap control to switch to unflatten mode and paste a flat object of dot-and-bracket path keys; the tool rebuilds the original nested objects and arrays. Flatten and unflatten are exact inverses for well-formed input.
What happens to keys that already contain a dot?
Dots are the path separator, so a key that itself contains a dot is treated as two path segments — the operation is lossy for such keys and unflattening will split them into nested keys. If your data has literal dots in key names, flattening is not round-trip safe for those keys.
Is my data uploaded anywhere?
No. Both flattening and unflattening run locally in your browser with JavaScript. Your JSON is never sent to a server, so it is safe for production payloads, and it keeps working offline.