I have my own object when there is no value it is coming as "NULL" in a string from downstream and it is failing while converting to java object in ObjectMapper
class Test
private String value1;
private String value2;
.... getters and setters.
Json Response is
{"Test": "NULL"}
How I can handle this in java Error message is :
** error : com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of com.test.Test (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('NULL') **
This is how I am converting json to java
ResponseEntity<String> responseEntity = getDownstreamResponse(id);
ObjectMapper mapper = new ObjectMapper();
Test test = mapper.readValue(responseEntity.getBody(), Test.class);