json对象后台接收接收取值

json数据:


{
    "code": "0",
    "data": {
        "channels": [
            {
                "channelId": 0,
                "onLine": "1"
            },
            {
                "channelId": 1,
                "onLine": "1"
            },
            {
                "channelId": 2,
                "onLine": "1"
            },
            {
                "channelId": 3,
                "onLine": "1"
            }
        ],
        "deviceId": "3B03FCEPBQFS79Z",
        "onLine": "1"
    },
    "msg": "操作成功。"
}


JSONObject js = (JSONObject) json.get("data");
JSONArray channels = js.getJSONArray("channels");  
JSONObject item ;
for (int i =0; i





你可能感兴趣的:(java)