ObjectMapper mapper = new ObjectMapper();
try {
String jsonStr = mapper.writeValueAsString(实体名);
System.out.println(jsonStr);
} catch (JsonProcessingException e) {
procException(e, "转换失败");
return null;
}
用ObjectMapper将实体类转换成string
最新推荐文章于 2023-07-31 22:30:44 发布