I basically have 2 different condition which can impact the value of a key in the output.
I have following input:
{
"state": "PRESENT",
"sample": {
"type": "OP"
}
}
I have following spec:
[
{
"operation": "shift",
"spec": {
"state": {
"PRESENT": {
"#ANSWER1": "answer"
},
"*": {
"$": "answer"
}
},
"sample":{
"type":{
"OP":{
"#ANSWER2": "answer"
}
}
}
}
}
]
Now if you see that both the conditions are true, the final output is as following. Both the values come in form of an array
{
"answer" : [ "ANSWER1", "ANSWER2" ]
}
But I am looking for an output based on the second condition. Basically override the existing value in "answer" attribute:
{
"answer" : "ANSWER2"
}