FastJson之JsonObject, JsonString, JavaBean,List快速转换

 


// 将json字符串转换为json对象
JSONObject jsonObject = JSON.parseObject(jsonStr); // {"retState":"SUCCESS","retCode":"000000","retMsg":"成功", "data":[{"id":2150,"name":"合肥市","address":null}],"total":0} // json字符串转java对象 String data = jsonObject.getString("data"); ComboxResponse city = JSON.parseObject(data, List<ComboxResponse>.class); // json字符串转List集合 ComboxResponse city = JSON.parseArray(data, ComboxResponse.class).get(0);



 

     

posted @ 2018-09-05 21:25  Peter.Jones  阅读(134)  评论(0编辑  收藏  举报