>_devtools

JSON Unflatten

Rebuild nested JSON objects and arrays from flat dot or bracket paths such as user.emails[0].

What this does

Expands a flat JSON object of paths back into nested objects and arrays. It understands dot paths (a.b.c), bracket indexes (a[0]), quoted keys (["a.b"]), and any custom separator.

How paths are read

  • items[0].name creates an array items whose first element has a name.
  • With Numeric segments become array indexes on, items.0.name does the same. Turn it off to keep 0 as an ordinary object key.
  • Gaps in an array, such as only list[2] being present, are filled with null. Indexes above 100,000 are rejected so a typo cannot allocate a huge array.

Conflicts

If one path is a value and another path goes through it (a and a.b), the tool stops and names the path that conflicts instead of silently dropping data. Keys such as __proto__ are treated as ordinary data and cannot affect the page.

Example

Input:

{"user.name":"Ada","user.emails[0]":"a@x.io","user.emails[1]":"b@x.io"}

Result:

{
  "user": {
    "name": "Ada",
    "emails": ["a@x.io", "b@x.io"]
  }
}

Privacy

Everything runs in your browser. Your input is never uploaded, stored, or put in the page URL.