I have requirement where input will have one or two arrays based on scenarios:
Input 1:
{
"name": "xyz",
"age": "30",
"addressA": [
{
"id": "111111",
"details": ""
},
{
"id": "111112",
"details": ""
}
],
"addressB": [
{
"id": "222222",
"details": ""
},
{
"id": "222223",
"details": ""
}
]
}
Input 2:
{
"name": "xyz",
"age": "30",
"addressB": [
{
"id": "222222",
"details": ""
},
{
"id": "222223",
"details": ""
}
]
}
So when 'addressA' is present in input json it should use that to give output if its no present then it should use 'addressB' to populate the same
Output expected:
For input 1:
[
{
"id": "111111",
"details": ""
},
{
"id": "111112",
"details": ""
}
]
For Input 2:
[
{
"id": "222222",
"details": ""
},
{
"id": "222223",
"details": ""
}
]
Any help would be appreciated.
I see option in JOLT to have if-else based on string value, but could not find anything to check just if exists
Thanks Mahendra