关于list字符串转成list

String jsonStr = "[{\"command\": \"action.devices.commands.ColorAbsolute\",\"params\": {\"color\": {\"temperature\": 5000}}}]";
List<Map<String,String>> listObjectFir = (List<Map<String,String>>) JSONArray.parse(jsonStr);
List<Map<Object,Object>> result = new ArrayList<>();
for(Map<String,String> mapList : listObjectFir){
Map<Object, Object> map = new HashMap<>();
for (Map.Entry entry : mapList.entrySet()){
map.put(entry.getKey(),entry.getValue());
System.out.println( entry.getKey() + " " +entry.getValue());
}
result.add(map);
}
return result;
posted @ 2022-07-22 10:01  社畜诚  阅读(1414)  评论(0)    收藏  举报