JSON转化为JAVABEAN集合

String str = "[{'id':'392','type':'jpg'},{'id':'393','type':'jpg'},{'id':'377','type':'jpg'}]" ;

      JSONArray jArray=JSONArray. fromObject(str);

      List<UploadFile> list=JSONArray.toList (jArray ,UploadFile.class) ;

 

String  result = sendGetRequest(BaseEntity. SEARCH_URL + url);

      JSONObject json = JSONObject. fromObject(result);

      Integer status = json.getInt( "status");

      if(status == 0){

         totalPage = json .getInt("totalPage" );

         totalRows = json .getInt("totalRows" );

        JSONArray jsondata = json.getJSONArray("data");

         users = JSONArray.toList(jsondata, UserInfo.class );

posted @ 2016-12-15 16:45  逆流的鱼_飞  阅读(181)  评论(0编辑  收藏  举报