I have a json input object, and want to do a json transformation using jolt transformer. can help to acheive this
Input is
{
"keys": [
"key1",
"key2",
"key3"
],
"values": [
[
"value 1.1",
"value 2.1",
"value 3.1"
],
[
"value 1.2",
"value 2.2",
"value 3.2"
]
]
}
and the expected output is
{
"Result": [
{
"key1": "value 1.1",
"key2": "value 2.1",
"key3": "value 3.1"
},
{
"key1": "value 1.2",
"key2": "value 2.2",
"key3": "value 3.2"
}
]
}
>Solution :
You can loop hrough values array while picking the values from the keys after traversing 3 levels such that
[
{
"operation": "shift",
"spec": {
"values": {
"*": {
"*": "Result[&1].@(3,keys[&])"// &1 represents the outer indexes under "values" node
// & is for the inner indexes
}
}
}
}
]