$$unflatten
Accepts an object with dot separated field names and merges them into an hierarchical object.
Usage​
{
"$$unflatten": /* object */,
"target": /* target object */,
"path": ""
}
"$$unflatten([target],[path]):{input}"
Returns​
array
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | object | Yes | Object with dot separated field names | |
target | object | null | A target to merge into | |
path | string | null | The root path in the target to merge into |
Examples​
Input
Definition
Output
{
"a.a1": 123,
"a.a2.b.c": true,
"b": "bbb"
}
{
"$$unflatten": "$",
"path":"x",
"target": {
"y": 0
}
}
{
"y": 0,
"x": {
"a": {
"a1": 123,
"a2": {
"b": {
"c": true
}
}
},
"b": "bbb"
}
}
{
"a.a1": 123,
"a.a2.b.c": true,
"b": "bbb"
}
"$$unflatten:$"
{
"a": {
"a1": 123,
"a2": {
"3": {
"c": true
}
}
},
"b": "bbb"
}