json字符串转Map集合
/** * json字符串转list * @param jsonStr * @return */ public static List<Map<String,Object>> GetJsonListByString(String jsonStr){ List<Map<String, Object>> rsList = new ArrayList<>(); try { JSONArray arry = JSONArray.parseArray(jsonStr); for (int i = 0; i < arry.size(); i++) { JSONObject jsonObject = arry.getJSONObject(i); Set<String> stringSet = jsonObject.keySet(); Map<String, Object> map = new HashMap<>(); for (String key :stringSet){ Object value = jsonObject.get(key); map.put(key, value); } rsList.add(map); } } catch (Exception e) { e.printStackTrace(); } return rsList; }
吾乃代码搬运工,侵联删