JSON Unflatten Tool – Turn Dotted Keys into Nested JSON Free Online

Use the free JSON Unflatten Tool below: your data never leaves your browser — all work happens on your device, and nothing is uploaded to any server.

What Flat JSON Looks Like

Flat JSON is a single object where every key sits at the top level, even when the data describes something nested. Instead of an object inside an object, you get keys joined by dots, like “user.name” and “user.address.city”. This shape shows up a lot in real work. Spreadsheets export this way, settings files use it, and many APIs accept it as a compact input format. It is easy to read one key at a time, but it is hard to use as real structure. Code that expects a nested object cannot work with dotted keys directly, and a human reader has to rebuild the shape in their head. That is the gap this tool closes.

The tool above takes your flat object and expands every dotted key into real nesting. The key “user.address.city” becomes an object called user, holding an object called address, holding the value for city. Numbered parts, like “tags.0” and “tags.1”, become array positions. The result is normal, pretty-printed JSON ready to paste into code or a config file.

Why Dotted Keys Exist

Dotted keys are popular because they are simple to store and simple to sort. A spreadsheet has one row of column names, so a nested path has to be squeezed into a single cell, and dots are the natural separator. Form libraries do the same thing: a field named “billing.street” maps cleanly onto a nested address object when the form is submitted. Environment-style settings also favour this shape, since one flat list is easier to scan than a deep tree. None of this is wrong. Flat data is a fine transport format. The problem only appears when you need to work with the data as structure, and that is when unflattening earns its keep.

Searching is also easier in flat data: finding every key that starts with “user.” is a simple text filter, while walking a nested tree needs code. So teams often store data flat and expand it only at the moment of use. That workflow is exactly what the tool supports, and nothing is uploaded, so even private settings can pass through safely.

How To Use The Tool

Paste your flat JSON object into the box. If your data uses a different separator, such as an underscore, type it in the separator field before you convert. Press the unflatten button and read the result below. A copy button puts the nested JSON on your clipboard, and the download button saves it as a file called unflattened.json. Check the output once before you use it: if a key was meant to be a literal dot in a name, the tool cannot know that, and it will split it. In that case, rename the key in your source first, or use a separator that does not appear in your real key names.

A good test case is the example already in the box. It mixes a plain key, a nested name and age, and a numbered list of tags. Run it and watch how the plain key stays at the top, the user keys gather under one object, and the numbered tags become a true array. Once you see that pattern, your own data will behave the same way.

Arrays, Numbers, And Edge Cases

The trickiest part of unflattening is deciding when a numbered part means an array and when it is just a name that happens to be a number. This tool treats a part made only of digits as an array index, which matches the common convention from form libraries and spreadsheet exports. So “items.0” and “items.1” build an array called items with two entries. If your data has a key like “codes.2024”, that will also become an array position, which may not be what you want. When a number is really a label, such as a year, keep it as part of a longer name, like “codes.year2024”, and the tool will leave it as an object key.

Two more edge cases are worth knowing. First, if the same path appears twice with different endings, both values survive under their own keys, because the tool merges shared parents instead of overwriting them. Second, if a key is both a value and a parent, for example “user” and “user.name” in the same object, the tool cannot keep both shapes at once, and the later value wins for the shared spot. Clean input avoids this: decide whether a name holds a value or holds children, and do not use it for both. With that rule, the output is predictable every time.

Where Unflattened JSON Is Useful

Unflattened JSON is useful anywhere nested structure is expected. API requests are the most common case: many endpoints want an address object, not a flat “address.city” string, and pasting the expanded form removes a whole class of rejected requests. Config files are another case, since tools that read nested settings will ignore dotted keys they do not recognise. Data cleanup is a third case: turning a spreadsheet export into nested JSON makes it ready for a database import or a chart tool that groups by category.

It also helps when you are learning how data is structured. Seeing a flat list turn into a tree makes the hierarchy visible, and that picture sticks. Because everything runs locally, you can practise on real project data without worrying about where it goes.

Related tools

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top