I have got java string(containing json object)
{"Attribute_1":""test"","Attribute_2":"100"}
When I covert to java object MyCustomClass i get runtime error because of double quotes around test
. I am not sure how to escape double quotes inside
json attribute value
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(requestData, MyCustomClass.class);
Error is
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('t' (code 116)): was expecting comma to separate OBJECT entries
at [Source: {"Attribute_1":""test"","Attribute_2":"100"} line: 1, column: 12]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:437)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._skipComma(ReaderBasedJsonParser.java:1795)
This is not a duplicate of How to escape double quotes in JSON by an chance as that is display issue