JSON Unflatten

Paste an object of flat key paths, such as {"order.id": "A-1001", "order.items.0.sku": "SAR-01"}, and get nested JSON back. Numeric parts of a path become array positions, so lists are rebuilt as lists. If two paths contradict each other, for example a key that is both a value and a parent, you are told which one.

Action
JSON
Result

Processing runs in your browser. What you type never leaves this device.

Features

  • Dot, underscore, slash or double-underscore paths

  • items.0.sku and items[0].sku both become arrays

  • Clear message for conflicting paths

  • Reverse button to flatten again

  • Runs in your browser

Where flat keys come from

Spreadsheet and form exports

Columns named customer.name and customer.phone come back as a proper customer object.

Config and environment variables

Keys like DATABASE__HOST, with the double-underscore separator, become nested settings.

Translation files

Flat i18n keys become the nested structure most JavaScript i18n libraries expect.

How unflattening works

Arrays or objects?

When every key under a parent is a run of numbers starting at 0 (0, 1, 2 ...), the parent becomes an array. Anything else stays an object, so a gap like 0 and 2 keeps an object with keys "0" and "2".

Related tools

JSON flatten goes the other way. Other JSON tools: JSON formatter and validator, JSONPath tester, JSON to TypeScript and JSON to CSV.

JSON Unflatten - FAQ