I have a few boolean fields in the payload, in any case only ONE field will be true. But sometimes payload will have only two of these boolean fields. I want to check if payload has this boolean field, then use it for mapping else ignore it.
Input payload:
{
"IsTypeA" : true,
"IsTypeB" : false,
"IsTypeC" : false,
"text1" : "abc",
"text2" : "def"
}
Possible variation of input payload:
{
"IsTypeB" : true,
"IsTypeC" : false,
"text1" : "abc",
"text2" : "def"
}
I need to calculate the value of output field using IsTypeA,IsTypeB,IsTypeC only if they exist.
Pseudo code:
if IsTypeA exists
result: if(IsTypeA == true) true else false
else if IsTypeB exists
result: if(IsTypeB == true) true else false
else if IsTypeC exists
result: if(IsTypeC == true) true else false
else false