JSON input:
{
"id": 1,
"name": "example",
"value1": [0.67, 0.78, 0.245],
"value2": [0.45, 0.55, 0.65],
"value3": [0.1, 0.2, 0.3],
"otherField": "some data"
}
JSON output
{
"id": 1,
"name": "example",
"value1": [0.33, 0.22, 0.755],
"value2": [0.55, 0.45, 0.35],
"value3": [0.9, 0.8, 0.7],
"otherField": "some data"
}
I want jolt spec for the above transformations 1 - array elements
Note that the number of the elements within the value arrays may vary
You can try the following spec:
[
{//This is to Subtract
"operation": "modify-overwrite-beta",
"spec": {
"*": "&",
"value*": {
"*": "=doubleSubtract(1.0,@(0))"
}
}
},
{//This is to Round by 3 digit at most
"operation": "modify-overwrite-beta",
"spec": {
"*": "&",
"value*": {
"*": "=divideAndRound(3,@(0),1.0)"
}
}
}
]
I hope it works.