如何将fastjson的JSONObject和JSONArray遍历成列表或映射?
- 内容介绍
- 文章标签
- 相关推荐
本文共计369个文字,预计阅读时间需要2分钟。
JSON List Map 简单的相互转换
使用 Alibaba.fastjson.jar
javapublic void testJSON() { String strOne={\one:1, two:2, three:3}; // 遍历JSONObject JSONObject jsonObjectOne=JSONObject.parseObject(strOne); for (Entry json : jsonObjectOne.entrySet()) { // 输出键值对 System.out.println(json.getKey() + : + json.getValue()); }}
/**
*alibaba.fastjson.jar
* @param args
*/
public void testJSON() {
String strOne = "{one:1, two:2, three:3}";
//遍历JOSNObject
JSONObject jsonObjectOne = JSONObject.parseObject(strOne);
for(Entry
本文共计369个文字,预计阅读时间需要2分钟。
JSON List Map 简单的相互转换
使用 Alibaba.fastjson.jar
javapublic void testJSON() { String strOne={\one:1, two:2, three:3}; // 遍历JSONObject JSONObject jsonObjectOne=JSONObject.parseObject(strOne); for (Entry json : jsonObjectOne.entrySet()) { // 输出键值对 System.out.println(json.getKey() + : + json.getValue()); }}
/**
*alibaba.fastjson.jar
* @param args
*/
public void testJSON() {
String strOne = "{one:1, two:2, three:3}";
//遍历JOSNObject
JSONObject jsonObjectOne = JSONObject.parseObject(strOne);
for(Entry

