I need a help on transformation in json message format, Here i need to remove empty objects in a json array dynamically and if we have single json attribute value (example "PersonIdType": "1180") should be remove the json object, fields are highlighted in input json :
Input json:
{
"PersonIdInfo": [{
"versionId": "1",
"getuToken": "123",
"userName": "Venkat",
"contactInfo": [
**{
},**
{
"phoneInfoCode": "3210",
"phoneNumber": "(123) 454-6789"
}
],
"PersonIdentification": [{
"PersonIdType": "1180",
"PersonId": "662-55-2525",
"PersonIDExpDate": "01/01/1952"
},
**{
"PersonIdType": "1180"
},**
**{
},**
{
"PersonIdType": "1190",
"PersonId": "662-55-2525",
"PersonIDExpDate": "01/01/1952"
}
]
}]
}
Requested Output json message:
{
"personIDInfodata": [{
"versionId": "1",
"getuToken": "123",
"userName": "Venkat",
"contactInfo": [{
"phoneInfoCode": "3210",
"phoneNumber": "(123) 454-6789"
}],
"PersonIdentification": [{
"PersonIdType": "1180",
"PersonId": "662-55-2525",
"PersonIDExpDate": "01/01/1952"
},
{
"PersonIdType": "1190",
"PersonId": "662-55-2525",
"PersonIDExpDate": "01/01/1952"
}
]
}]
}
Thanks for your help!!