Let's say i have such json and i would like to deserialize it to an object called SubscriberProfile.
{ "field1": "value1", "field2": "value2", "field3": "value3" }
When i use following code it works without any problem,
objectMapper.readValue(json,SubscriberProfile.class);
but i want objectmapper throw and exception if field2 is missing in json (field1 and field2 can be missing).
so such json should throw an exception
{ "field1": "value1", "field3": "value3" }
I've tried to use @JsonProperty(required=true)
annotation but works only when serialize it.
Do you have any idea how can i solve this problem?
Thanks in advance