Unflatten dot-notation JSON

Rebuild nested JSON objects and arrays from flat dot-notation keys.

freeworks offlinenothing uploaded
ToolJSON Unflatten
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Flat keys are split on the selected delimiter, numeric segments become array indexes, and each path is assigned into a new object or array. Later assignments can replace earlier values when paths collide.

  • Dot notation matches common flattened keys.
  • Numeric segments support indexed arrays.

Worked example

Dot Notation to Nested
Reconstruct nested objects from dot-notation keys
Input
											{"user.name": "Alice", "user.address.city": "Portland", "active": true}
										
Output
												{
  "user": {
    "name": "Alice",
    "address": {
      "city": "Portland"
    }
  },
  "active": true
}
											

When to use this

Form maps, CSV path columns, and query-string objects use unflattening.

Edge cases

  • A literal delimiter in a key becomes a path separator unless another delimiter is chosen.
  • Sparse indexes create empty positions between assigned elements.
  • Conflicting scalar and nested paths cannot both occupy the same location.

References