Support Questions
Find answers, ask questions, and share your expertise

jolt in nifi - help with jolt

jolt in nifi - help with jolt

New Contributor

hi, 

I have a problem with JOLT that it does not return a uniform answer for members of the array.

Attach an example to explain the problem .

 

The input: 

{
"result": [ {
"metric": {
"name": "name1",
"id": "id1"
}, "value": [ 1.123, "312" ]
},{
"metric": {
"name": "name2",
"id": "id2"
}, "value": [ 21.123,"44"]
}
]
}

and the apec is: 

[{
"operation": "shift",
"spec": {
"result": {
"*": {
"metric": {
"*": "&2.&0"
},
"@value[#1]": "&0.value",
"@value[#2]": "&0.timestamp"
}
}
}
}]


the output is : 

{
"0" : {
"value" : 1.123, // I expected to get here "value" : "312"
"timestamp" : 1.123,
"name" : "name1",
"id" : "id1"
},
"1" : {
"value" : "44",
"timestamp" : 21.123,
"name" : "name2",
"id" : "id2"
}
}

Tnx!