google 开源项目 gson教程教本.pdfVIP

  • 4
  • 0
  • 约2.16万字
  • 约 12页
  • 2018-10-16 发布于湖北
  • 举报
google 开源项目 gson教程教本

1.简单的处理 list 和map Java 代码 1.Gson gson = new Gson(); 2. List testList = new ArrayList(); 3. testList.add(first); 4. testList.add(second); 5. String listToJson = gson.toJson(testList); 6. System.out.println(listToJson); 7.//prints [first,second] 8. 9.Map testMap = new HashMap(); 10. testMap.put(id, id.first); 11. testMap.put(name,name.second); 12. String mapToJson = gson.toJson(testMap); 13. System.out.println(mapToJson); 14. //prints {id:id.first,name:name.second} Gson gson = new Gson();

文档评论(0)

1亿VIP精品文档

相关文档