I need to convert the following JSON to Java object. The property providerResponse
in the JSON contains map of properties but they are escaped and wrapped in doubleQuotes. As a result, it does not deserialize the property providerResponse
into a Java object (it comes as String
). I use objectMapper.readValue(msgStr, classType)
to deserialize the JSON. The message is generated by AWS for SNS delivery status notifications and I don't have control to change the JSON message. Is it possible to configure ObjectMapper
to unescape the property and deserialize into a Java object instead of String
?
{
"delivery":{
"providerResponse":"{\"sqsRequestId\":\"308ee0c6-7d51-57b0-a472-af8e6c41be0b\",\"sqsMessageId\":\"88dd59eb-c34d-4e4d-bb27-7e0d226daa2a\"}"
}
}
@JsonProperty("providerResponse")
private String providerResponse;