1、json转对象 使用 readValue()
2、对象转json 使用 writeValueAsString();
3、直接解析json 使用 readTree()
private static final ObjectMapper MAPPER = new ObjectMapper();............../***情况一:json 转 对象*/String json = this.redisUtils.get("itemDesc_" + itemId);if (StringUtils.isNoneBlank(json)) {ItemDesc itemDese = MAPPER.readValue(json, ItemDesc.class);}/***情况二:对象 转 json*/ PicUploadResult picUploadResult = new PicUploadResult();String json = MAPPER.writeValueAsString(picUploadResult);/***情况二:直接解析 json*///获取消息的内容{"itemId":1474391930,"type":"save"}String json = textMessage.getText(); if(StringUtils.isNotBlank(json)) {//解析消息内容JsonNode jsonNode = MAPPER.readTree(json);}