JSONObject jsonObject = JSONObject.parseObject(XxJson); Map<String, Object> map= jsonObject;
如果json是数组,则转成list
JSONArray jsonObject = JSONArray.parseArray(XxJson); List list= jsonObject;
根据需要还可以将map转换为list
List<String> list = new ArrayList<String>(map.values());
转键也可以
List<String> list = new ArrayList<String>(map.keySet());
本文介绍如何将JSON数据转换为Map以及在需要时转换回List。同时讲解了如何进行键的转换操作。
2484

被折叠的 条评论
为什么被折叠?



