android Json数据处理例子

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jian11058/article/details/89247564

后端数据结构:


// {"msg":[{"uid":["129,136,"],"info":[{"uid":"129,136,","alarmName":"C6T(736175838) \u95e8\u78c1\u4f20\u611f\u5668","alarmType":10004,"alarmTime":1554974337000,"deviceSerial":"736175838","alarmPicUrl":"https:\/\/i.ys7.com\/streamer\/alarm\/url\/get?fileId=20190411171858-736175838-1-10004-2-1&deviceSerialNo=736175838&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0"}]}]}


android处理:

	try {
            JSONObject jsonObject=new JSONObject(respose);
            if (jsonObject!=null){
                JSONArray jsonarray=jsonObject.getJSONArray("msg");
                for (int i=0;i<jsonarray.length();i++){
                    JSONObject jsonObject1=jsonarray.getJSONObject(i);
                    JSONArray uid_jsonarray=jsonObject1.getJSONArray("uid");
                    JSONArray info_jsonarray=jsonObject1.getJSONArray("info");
                    String uid_String=uid_jsonarray.toString();
                    EditStringUtils.dealString(uid_String,uid_list);
                    }
            }
	 } catch (JSONException e) {
	            e.printStackTrace();
	        }

猜你喜欢

转载自blog.csdn.net/jian11058/article/details/89247564