Input:
{
"request": {
"AccTyp": {
"AccTp": "0001",
"AccDesc": "Super"
},
"damId": "1006995",
"id": "1001",
"MaskedFlg": true
},
"existingResponse": {
"MaskedFlg": false,
"id": "1002"
}
}
Expected Output:
{
"request": {
"AccTyp": {
"AccTp": "0001",
"AccDesc": "Super"
},
"damId": "1006995",
"id": "1001",
"MaskedFlg": true,
"original": {
"damId": "",
"id": "1002",
"MaskedFlg": false,
"AccTyp": {}
}
}
}
For the input, add original object which should contain all fields that request obj is having. for This Original object fields, check if the same field is there in existingResponse, if so map the value otherwise keep it empty(strings should be intialised as empty(“”) and objects with {})