JSON Unflattener
Processed Client SideRestore flattened JSON back to its nested structure — dot paths and bracket indexes become real objects and arrays.
Bookmark this tool now — skip the search next time you need it.
About JSON Unflattener
This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.
The JSON Unflattener does the opposite job: it reads a flat list of paths and rebuilds the nested document they describe. Paste a JSON object whose keys are dot paths, or one key = value pair per line, or a two-column CSV, and customer.address.city becomes a city field inside an address object inside a customer object. Bracketed and bare numeric segments — items[0].sku or items.0.sku — become real array elements rather than objects with numeric keys, and a gap in the indexes is filled with null, since JSON has no way to write a hole. The input format is detected as you type, so a list copied out of a properties file, a spreadsheet column or a logging tool works without converting it first. Everything runs in your browser.
Key features
- Three input shapes accepted and detected automatically: a JSON object of paths, key = value lines, or a two-column CSV
- Both array notations understood — items[0].sku and items.0.sku rebuild the same array
- Numeric segments become array indexes, or stay object keys, from a single toggle — which is what you want when your data really is keyed by number
- Five separators supported, so paths joined by underscores, slashes, dashes or double colons expand as readily as dot paths
- Value types recovered from text input: 42, true, null and inline JSON become real values, while everything else stays a string
- Quoted values kept as text, so an order id of "0042" does not come back as the number 42
- Gaps in array indexes filled with null and reported, because a JSON array cannot have holes
- Clear warnings instead of silent damage when the input contradicts itself — a path that is both a value and a container, a key that appears twice, or array indexes mixed with named keys under one parent
- Comment and blank lines skipped, and a key,value header row ignored, so a pasted CSV export needs no cleaning up
- Prototype-safe: a __proto__ or constructor segment becomes an ordinary key and cannot reach the object prototype
- Syntax highlighting in both panes, copy to clipboard, download as .json, and a choice of 2 spaces, 4 spaces, tabs or minified output
How to use it
- Paste the flattened data into the left pane — a JSON object of paths, key = value lines, or CSV. The badge tells you which one was detected.
- Set the separator to whatever joins your keys: dot, underscore, slash, dash or double colon.
- Leave "Numbers make arrays" on to turn items[0] into an array, or switch it off to keep numeric segments as object keys.
- Leave "Detect value types" on for text input so numbers and booleans come back typed, or switch it off to keep every value a string.
- Choose the indentation for the rebuilt JSON, then read the warnings under the toolbar — they name every path the input could not describe cleanly.
- Copy the nested JSON or download it as a .json file.
Tips & common mistakes
- The separator has to match the one the paths were written with. If a document comes back looking like one long key with no nesting, the separator is wrong — try underscore or slash before assuming the input is broken.
- Turn off "Numbers make arrays" when your keys really are numbers. A price table keyed by year, or a lookup keyed by status code, should stay an object: as an array it would become ten thousand null entries with your data at the end.
- Quote a value in the text formats to keep it a string. 0042 and 1.10 both change when they are read as numbers — a leading zero disappears and a trailing zero is dropped — which matters for order ids, postcodes and version numbers.
- Missing array positions become null. If items[0] and items[2] arrive without items[1], the result has a null in the middle, because that is the only way JSON can express the gap. The warning tells you how many were filled in.
- Two paths that contradict each other are reported rather than merged quietly. If user is a value on one line and user.name is a value on another, the value loses and the nested keys are kept — flattened exports rarely contain both, so it usually means two files got mixed together.
- A CSV pasted straight out of a spreadsheet works: the key,value header row is skipped, quoted cells are unwrapped, and lines starting with # or // are treated as comments.
- Round-trip your work. Flatten a document with the JSON Flattener, expand it back here with the same separator, and the two should be identical — if they are not, the flattener warnings will say which key was ambiguous.
- This is the fastest way back from a properties file, a translation catalogue or a logging export to the JSON an API actually wants. Paste the whole list, set the separator, and post the result.
- The rebuilt document is ordinary JSON, so anything downstream works on it: send it to the JSON Formatter to re-indent, the JSON Validator to check it against expectations, or the JSON to CSV converter if you need a table of records rather than a table of keys.