1
{
    "parentWinnerInactivePartyID": "",
    "childMergeLoserPartyID": "",
    "eventType": "M&A",
    "startData": "2020-01-03",
    "endDate": null,
    "eventDate": "01-03-2020 08:09:14",
    "status": null,
    "mnaID": "1",
    "newMNAendDate": null,
    "createdBy": "abcd"
}

I have another field called transactionKey and I want to send only for certain eventTypes. How do I modify the request accordingly. What do I need to define in my POJO class?

My POST request would be something like,

{
    "parentWinnerInactivePartyID": "",
    "childMergeLoserPartyID": "",
    "eventType": "M&A Redo",
    "startData": "2020-01-03",
    "endDate": null,
    "eventDate": "01-03-2020 08:09:14",
    "status": null,
    "mnaID": "1",
    "newMNAendDate": null,
    "createdBy": "abcd",
    "transactionKey": "Andsf1234"
}
D. Lawrence
  • 943
  • 1
  • 10
  • 23
  • I believe this StackOverflow link may provide you with the answer: https://stackoverflow.com/questions/20578846/ignore-missing-properties-during-jackson-json-deserialization-in-java – Filippo Possenti Jan 06 '20 at 10:24
  • Can you have transaction key as null like endDate and newMNAendDate accepting null in the POST request? – priyanka Jan 06 '20 at 10:53
  • priyanka i can have null but the requirement is I need to make it optional field. Some events might have this request and some might not have this request – Amith Rampur Jan 06 '20 at 18:02
  • Filippo Possenti - This is at the class level and can help in changing the way response is sent and include only non null response. But i need for the request. – Amith Rampur Jan 06 '20 at 18:03

0 Answers0