首页 > 代码库 > JSON转化为JAVABEAN集合

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 = http://www.mamicode.com/json.getJSONArray("data");

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

JSON转化为JAVABEAN集合