json 转为 List<Map<String, Object>>
public static List<Map<String, Object>> toListMap(String json){
List<Object> list =JSON.parseArray(json);
List< Map<String,Object>> listw = new ArrayList<Map<String,Object>>();
for (Object object : list){
Map<String,Object> ageMap = new HashMap<String,Object>();
Map <String,Object> ret = (Map<String, Object>) object;//取出list里面的值转为map
listw.add(ret);
}
return listw;
}
List<Map<String, Object>> 转为 json(String)
List<Map<String, Object>> list= openDao.queryForList(map);
String str = JSON.toJSONString(list); //此行转换
caChe.writeFile(finerPath,finerPath+"finerCaChe.txt",str);