JSON与List之间的转换

jsonString转换为list:

JSONArray jsonArray=JSONArray.fromObject(result);
List<RentCar> books=(List)JSONArray.toList(jsonArray, Class);

 

list转换为jsonString

Gson gson=new Gson();
bookString = gson.toJson(list);
posted @ 2018-01-26 18:21  从程序员到外卖小哥  阅读(308)  评论(0编辑  收藏  举报