I'm trying to use JOLT to reorder a nested array. My goal is to group all elements that are located in the same array position (i) and add them to another array.
Input:
{
"values": [
[
"84139",
"123"
],
[
"230",
"456"
],
[
"230475",
"789"
]
]
}
Desired result:
{
"result": [ // same length as values[i]
[ // same length as values
"84139",
"230",
"230475"
],
[
"123",
"456"
"789"
]
]
}
INFO: keep in mind the length of both arrays' (root and child) length is variable so the solution has to be generic.
Additional input:
{
"values": [
[
"84139",
"123",
"000"
],
[
"230",
"456",
"000"
]
]
}
Additional output:
{
"result": [
[
"84139",
"230"
],
[
"123",
"456"
],
[
"000",
"000"
]
]
}