Rebuild a nested JSON document from bracket paths
Unflatten rebuilds arrays and objects from the bracket-path map produced by JSON Flattener. It is useful when path/value data needs its original hierarchy again.
When should you use it?
- Restore a flattened configuration.
- Turn exported path/value pairs back into nested data.
- Verify a flattening round trip.
Example: restore a nested object
Paths must agree about object and array structure. A gap in array indexes is an error.
{"$[\"user\"][\"name\"]":"Alex"}{"user":{"name":"Alex"}}Supply paths that agree on the container structure
A path ending in [0] implies an array; a quoted name implies an object member. Two entries cannot assign a scalar to a parent and also place a child beneath it. The tool rejects those conflicts because silently choosing one would discard data. Start with output from the matching Flatten tool when you need a known-compatible example.
Resolve array gaps deliberately
A map containing index 0 and index 2 leaves the meaning of index 1 undefined. This tool rejects array gaps instead of inventing null entries. Check the missing record in the source or choose the intended placeholder yourself. An unflattened result restores structure represented by the path map; it cannot recover comments, original whitespace, or values that were never included in that map.
How do I rebuild arrays from flattened JSON paths?
Provide a JSON object whose keys are $ bracket paths. Numeric segments such as [0] and [1] create array positions; quoted segments create object properties. The tool rejects conflicting container types and missing array indexes rather than inventing values.
Path/value map for a two-item array
json{
"$[\"roles\"][0]": "editor",
"$[\"roles\"][1]": "viewer"
}The result is {"roles":["editor","viewer"]}. Add index 2 after 1; skipping straight to 3 is an error.
Why does an array gap fail?
JSON arrays have a value at every serialized position. Inferring a missing element would silently choose a value such as null that the input did not specify.
What should you check before using the result?
Conflicting paths, mixed container types, and gaps in array indexes produce errors. It cannot infer missing values or interpret arbitrary dot-separated keys.
Understand JSON pathsTechnical reference: JSON syntax and interoperability · RFC 8259