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);
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);
转载于:https://www.cnblogs.com/itjunjun/p/8360905.html