接口返回的为数组形式的json 字符串

返回数据示例
5. {  
6.     "msg" : "成功",  
7.     "code" : "200",  
8.     "status" : "0",
16.      "data" : [ {
17.                  "mac":"00:00:00:00:00:00",
18.                  "data:[{
19.                       "intWhileId":"1",
20.                       "intStatus":"2",
21.                       "strDescription":""
22.                     },
23.                   {
24.                       "intWhileId":"2",
25.                       "intStatus":"2",
26.                       "strDescription":""
9.                     }]
10.                 },
27.               {
28.                  "mac":"11:11:11:11:11:11",
29.                  "data:[{
30.                       "intWhileId":"3",
31.                       "intStatus":"2",
32.                       "strDescription":""
33.                     },
34.                   {
35.                       "intWhileId":"4",
36.                       "intStatus":"3",
37.                       "strDescription":"失败,原因"
11.                     }]
12.                 }
13. }

 

public void getAssetWhiteId(){//每隔6小时执行一次
		String strMacs= "";
		//得到要获取白名单审核状态的mac
		List selectAssetWhiteMac = assetWhiteDao.selectAssetWhiteMac();
		for (AssetWhite assetWhite : selectAssetWhiteMac) {
			strMacs += assetWhite.getStrDeviceMac() + ",";
		}
		log.info("---------strMacs------------"+strMacs);
		String requestUrl = "/while/appendWhileCheck";
		/*下面的时进行上传云探进行任务创建*/
		if ("".equals(strMacs)) {
			log.info("---------设备mac不能为空---------");
		}
		JSONObject json = new JSONObject();
		json.put("strToken", strMacs.subSequence(0, strMacs.length()-1));
		json.put("strMacs", strMacs.subSequence(0, strMacs.length()-1));
		
		try {
		JSONObject jsonReturn = PubFunc.sendToYT(requestUrl, json);
		log.info("------------------获取白名单审核状态--------------------------------"+jsonReturn);
		if ("0".equals(jsonReturn.getString("status"))) {
		JSONArray array = jsonReturn.getJSONArray("data");
		array = JSONArray.parseArray(new String(array.toJSONString().getBytes("UTF-8"), "UTF-8"));
		HashMap params = new HashMap();	
		for (int i = 0; i < array.size(); i++) {
			 JSONObject object = (JSONObject) array.get(i);
			 log.info("----------object------------"+object);
	       String mac=object.getString("mac");
	       JSONArray dataArray = object.getJSONArray("data");
	         for(int j=0;j

你可能感兴趣的:(接口返回的为数组形式的json 字符串)