import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JsonToListUtil {
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>> maps = JsonToListUtil.toListMap(opResultStr);