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);
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);