JSON数组转换为List

论坛 期权论坛 脚本     
匿名技术用户   2021-1-4 20:08   516   0

1.List<Map<String,String>> listObjectSec = JSONArray.parseObject(strArr,List.class);

for(Map<String,String> mapList : listObjectSec){

for (Map.Entry entry : mapList.entrySet()){

System.out.println( entry.getKey() + " " +entry.getValue());

}
}

2.List<Map<String,String>> listObjectFir = (List<Map<String,String>>) JSONArray.parse(strArr);

for(Map<String,String> mapList : listObjectFir){

for (Map.Entry entry : mapList.entrySet()){

System.out.println( entry.getKey() + " " +entry.getValue());

}
}

转载于:https://www.cnblogs.com/aaron95/p/11451770.html

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP