List> to org.json.JSONObject?

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

         


        
8条回答
  •  感情败类
    2020-12-14 20:41

    Also: you could consider using one of other parsers from json.org's list: most of them allow your Json "objects" and "arrays" to map natively to java.util.Maps and java.util.Lists; or in some cases to real Java objects too.

    My recommendation would be Jackson, http://jackson.codehaus.org/Tutorial which allows for mapping to List/Map/Integer/String/Boolean/null, as well as to real Beans/POJOs. Just give it the type and it maps data to you, or writes Java objects as Json. Others like "json-tools" from berlios, or google-gson also expose similar functionality.

提交回复
热议问题