something like this will work.
String t = ""{\"message\":\"test\"}"";
ObjectMapper mapper = new ObjectMapper();
mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
JsonFactory factory = mapper.getFactory();
JsonParser createParser = factory.createParser(t);
JsonNode actualObj1 = mapper.readTree(createParser);
TestModel t11 = mapper.readValue(actualObj1.asText(), TestModel.class);
System.out.println(t11.getMessage());
Below is the TestModel class
public class TestModel {
public TestModel() {
}
@JsonProperty("message")
private String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…