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

上一篇:61. Unique Paths && Unique Paths II


下一篇:LeetCode: Unique Paths II 解题报告