废话就不说了 早上10点研究到现在
获取redis的JSON字符串
String getPalletListNew = redisService.getRedis("getPalletListNew", abroad + "" + goodsLevel + "" + startPort + "" + destinationPort + "" + maxTon + "" + minTon);
转换Map<String,Object>
public Map<String, Object> jsonToMap(String json){
Map<String, Object> map = new HashMap<>();
map = JSON.parseObject(JSON.parse(json).toString(),HashMap.class);
return map;
}
转换List<Map<String, Object>>
//将json斜杠转义
String s = StringEscapeUtils.unescapeJava(tuijianhuopan);
//调用
List<Map<String, Object>> list = redisService.jsonToListMap(s);
public List<Map<String, Object>> jsonToListMap(String json){
//QNMB 就是这里卡死我了,转义后的字符串前后带""根本无法解析,所以要切掉!!!
String strJson = StringUtils.substring(json,1,json.length()-1);
List<Map<String, Object>> listmap = (List<Map<String, Object>>) JSONArray.parse(strJson);
return listmap;
}