JSON Unflatten

Turn flat JSON with keys like user.address.city back into nested objects and lists.

Processed on your device. Files are not uploaded

How to rebuild nested JSON

  1. Paste your flat JSON

    Paste or type it into the box, or press Try an example.

  2. Choose the separator

    It must match the one used in the keys.

  3. Copy or download

    Use the nested document in your code.

Worked example

This is what JSON Unflatten gives for its own sample values. Open the tool above and change anything to try your own.

Flat JSON

{
  "user.name": "Ada",
  "user.langs.0": "en",
  "user.langs.1": "fr",
  "active": true
}
Separator
.
Indentation
2 spaces

Nested JSON

{
  "user": {
    "name": "Ada",
    "langs": [
      "en",
      "fr"
    ]
  },
  "active": true
}

About JSON Unflatten

Turn flat JSON with keys such as user.address.city back into nested objects. Number segments such as tags.0 rebuild lists.

FAQs

How does it know when to make a list?

When a key segment is a whole number, the parent becomes a list.

What if two keys clash?

A later key can overwrite an earlier one, so check the result.

Can I flatten JSON?

Use JSON Flatten.

Related tools