JSON Unflatten

Paste a flat JSON object whose keys are paths, such as user.name and tags.0, and get the nested JSON they describe.

How it works

Each key is split on the separator you choose: a dot, a slash or an underscore. Bracket positions such as tags[0] are always read as well. The parts become the levels of the nested object, and the value goes at the end of the path.

When the keys under one parent are exactly 0, 1, 2 and so on, starting at 0 with no gaps, they become a list. Turn that off to keep them as object keys named "0", "1" and "2".

Keys stay in the order they first appear, and numbers keep their exact digits. If two keys disagree, such as a set to 1 and a.b set to 2, the tool stops and explains which key needs which.

How to use it

  1. 1 Pick the separator your keys use.
  2. 2 Pick whether keys 0, 1, 2 become a list or stay object keys.
  3. 3 Paste the flat JSON object into the first box. The nested JSON appears in the second box.
  4. 4 Copy the result, or download it as a .json file.

Good to know

  • This is the reverse of JSON Flatten. Use the same separator in both directions and the round trip is exact, empty objects and lists included.
  • Keys copied from environment variables often use a double underscore, such as DB__HOST. Pick the underscore separator, and empty parts between the two underscores show up as "" keys; replace __ with . first for a clean result.
  • If list positions have a gap, such as tags.0 and tags.2, the result is an object with keys "0" and "2", because a list cannot have a hole.
  • The input must be one JSON object. To unflatten a CSV export, convert it to JSON first.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Turning dotted keys back into nested JSON

Flat keys show up in many places: a spreadsheet export with columns named address.city, a translation file with keys like checkout.button.label, a key-value store, form field names such as users[0].email, or a config that was flattened to be diffed. A program usually needs the nested form instead, the one where address is an object with a city inside it. Unflattening rebuilds that structure by reading each key as a path and placing its value at the end of it.

Each key is split on the separator you pick. With the dot, user.address.city becomes three levels: user, then address, then city. Bracket positions are always read too, so tags[0] and tags.0 mean the same thing, and the two styles can be mixed in one key, as in users[0].name. Keys that share a beginning share a parent, so user.name and user.email end up side by side in one user object, in the order their keys first appeared.

Numbered keys become lists, but only when that loses nothing. If the keys under a parent are exactly 0, 1, 2 and so on, starting at zero with no gaps, they become a JSON list. If they start at 1, skip a number, or are mixed with other names, they stay object keys called "1", "3" and so on, because forcing them into a list would shift values or leave holes. You can also switch list building off and keep every numbered key as an object key, which is what you want for data such as a map from HTTP status codes to messages.

Some inputs cannot be unflattened without losing data, and the tool refuses them rather than guessing. If one key sets a to the number 1 and another sets a.b, a would have to be both a number and an object. The error names both keys, so you can see which one is wrong. An empty object or list in the input, written as {} or [], is treated as an empty container that later keys may fill.

The JSON is read with a parser that keeps numbers as the digits you wrote, so long IDs and precise decimals come through unchanged, and the output is indented with two spaces. It is the reverse of JSON Flatten: flatten, edit the flat keys in a spreadsheet or text editor, then unflatten with the same separator to get the nested file back. Everything runs in your browser and nothing is uploaded.

Frequently asked questions

Why did my numbered keys not become a list?

They become a list only when they are exactly 0, 1, 2 and so on, in that order with no gaps. Keys that start at 1, skip a number or have leading zeros stay object keys, so no value is lost or shifted.

What does "needs ... to hold an object" mean?

Two keys disagree. If a is 1 and a.b is 2, a would have to be both the number 1 and an object containing b. The tool cannot pick one without losing data, so it names both keys and stops.

Can a key mix dots and brackets?

Yes. users[0].name and users.0.name both put name inside the first item of users.

Is my JSON uploaded?

No. It is rebuilt in this page and never sent anywhere.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.