使用jackson:JsonNode.get().toString()获取json中的字符串出错,多了一层双引号
//msg="{"method": "get_weather_city","timestamp":234655464,"req_id": 10086,"params":{"cityId":892}}"
JsonNode reqMsg = objectMapper.readTree(msg);
String method=reqMsg.get("method").toString();
//导致:method=""get_weather_city""出错
//解决方式:
//msg="{"method": "get_weather_city","timestamp":234655464,"req_id": 10086,"params":{"cityId":892}}"
JsonNode reqMsg = objectMapper.readTree(msg);
String method=reqMsg.get("method").asText();