When trying to map multi-level arrays, as follows:
var from =
{ Items:
[
{ SubItems:
[
{ SubKey: 'item 1 id a' },
{ SubKey: 'item 1 id b' }
]
},
{ SubItems:
[
{ SubKey: 'item 2 id a' },
{ SubKey: 'item 2 id b' }
]
}
]
}
I am trying to transform the names of the keys, keeping them in the same place in the array, like the following mapping example:
var map = {
'Items[].SubItems[].SubKey': 'items[].subitems[].subkey',
}
The results I expect are:
var expected =
{ items:
[
{ subitems:
[
{ subkey: 'item 1 id a' },
{ subkey: 'item 1 id b' },
]
},
{ subitems:
[
{ subkey: 'item 2 id a' },
{ subkey: 'item 2 id b' },
]
}
]
}
Unfortunately, the array items in the sub array all get grouped into the same parent item, as follows:
{ items:
[ { subitems:
[ { subkey: 'item 1 id a' },
{ subkey: 'item 1 id b' },
{ subkey: 'item 2 id a' },
{ subkey: 'item 2 id b' } ] } ] }
When trying to map multi-level arrays, as follows:
I am trying to transform the names of the keys, keeping them in the same place in the array, like the following mapping example:
The results I expect are:
Unfortunately, the array items in the sub array all get grouped into the same parent item, as follows: