public static List<Map<String, String>> jsonToList(String json) { JSONReader reader = new JSONReader(new StringReader(json));// 已流的方式处理,这里很快 reader.startArray(); List<Map<String, String>> rsList = new ArrayList<Map<String, String>>(); Map<String, String> map = null; int i = 0; while (reader.hasNext()) { i++; reader.startObject();// 这边反序列化也是极速 map = new HashMap<String, String>(); while (reader.hasNext()) { String arrayListItemKey = reader.readString(); String arrayListItemValue = reader.readObject().toString(); map.put(arrayListItemKey, arrayListItemValue); } rsList.add(map); reader.endObject(); } reader.endArray(); return rsList; }
原文地址:https://www.cnblogs.com/hjwq/p/8677099.html
时间: 2024-10-29 00:58:41