List> to org.json.JSONObject?

后端 未结 8 2025
借酒劲吻你
借酒劲吻你 2020-12-14 20:12
List> list = new ArrayList>();
Map map = new HashMap();

         


        
8条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 20:55

    If you are using org.json.simple.JSONArray

    (https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple/1.1.1)

    List> list = new ArrayList>();
    Map map = new HashMap();
    map.put("abc", "123456");
    map.put("def", "hmm");
    list.add(map);
    
    JSONArray jsonArray = new JSONArray();
    jsonArray.addAll(listOfMaps);
    

提交回复
热议问题