$$unflatten
Accepts an object with dot separated field names and merges them into an hierarchical object
Usage​
{
"$$unflatten": /* Object with dot separated field names */,
"target": null /* object */,
"path": null /* string */
}
"$$unflatten([target],[path]):{input}"
note
Concrete values in the usage example are default values.
Returns​
object
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
{
"value": "bbb"
}
{
"$$unflatten": {
"a.a1": 123,
"a.a2": [
1,
2,
3,
{
"c": true
}
],
"b": "$.value"
}
}
{
"a": {
"a1": 123,
"a2": [
1,
2,
3,
{
"c": true
}
]
},
"b": "bbb"
}
{
"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": {
"b": {
"c": true
}
}
},
"b": "bbb"
}