I have a set of JSON objects having the wsDestAddress
key, so how do I traverse the JSON objects or do a wild search for wsDestAddress
key in present JSON objects to find the key is present or not and returning null
or ""
?
JSON Object #1
{
"gfutd": {
"wsRequestData": {
"wsDestAddress": ""
}
}
}
JSON Object #2
{
"igftd": {
"wsRequestData": {
"wsDestAddress": ""
}
}
}
JSON Object #3
{
"y7igfutd": {
"wsResponseData": {
"wsDestAddress": ""
}
}
}
JSON Object #4
{
"y7igptdf": {
"wsRequestData": {
"returnAddress": {
"wsDestAddress": ""
}
}
}
}
I know this code works fine
if (y7igfutd.wsRequestData.wsDestAddress == "" ||
igftd.wsRequestData.wsDestAddress == "" ||
y7igfutd.wsResponseData.wsDestAddress == "" ||
y7igfutd.wsRequestData.returnAddress.wsDestAddress == "") {
return "result"
}
But I want to do a wild search for wsDestAddress
as the JSON keys search.