Input:
[
{
"ImageId" : [ "ami-06a13556596424b", "ami-04d29b6f966df15" ],
"InstanceId" : [ "i-0b456d23d0a5e44", "i-072b95b1d6a4b11" ],
"InstanceType" : [ "t2.micro", "t2.micro" ]
}
]
required output:
[
{
"ImageId": "ami-06a13556594b01",
"InstanceId": "i-0b456d23d0a5e3",
"InstanceType": "t2.micro"
},
{
"ImageId": "ami-04d29b6f966df37",
"InstanceId": "i-072b95b1d6a436",
"InstanceType": "t2.micro"
}
]
You can use the fllowing shift transformation spec :
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"*": { // the indexes of the respective arrays
"@": "[&].&2"
}
}
}
}
}
]
where
&2 copies the keys of the arrays respectively
[&] separates the objects by the indexes of the arrays to return in array-wise maner as a whole
the demo on the site https://jolt-demo.appspot.com/ is :