jsonオブジェクトバックグラウンド受信受信値

1247 ワード

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