如何在 Android 中解析 JSONArray
我想读这行,但因为它开始于我有点困惑JSONJSONArray
 "abridged_cast": [
            {
                "name": "Jeff Bridges",
                "id": "162655890",
                "characters": [
                    "Jack Prescott"
                ]
            },
            {
                "name": "Charles Grodin",
                "id": "162662571",
                "characters": [
                    "Fred Wilson"
                ]
            },
            {
                "name": "Jessica Lange",
                "id": "162653068",
                "characters": [
                    "Dwan"
                ]
            },
            {
                "name": "John Randolph",
                "id": "162691889",
                "characters": [
                    "Capt. Ross"
                ]
            },
            {
                "name": "Rene Auberjonois",
                "id": "162718328",
                "characters": [
                    "Bagley"
                ]
            }
        ],
我只需要使用“名称”并将所有内容保存为一个字符串。(字符串值将为:Jeff Bridges,Charles Grodin,Jessica Lange,John Randolph,Rene Auberjonois)。
这是我的代码:
try {
        //JSON is the JSON code above
        JSONObject jsonResponse = new JSONObject(JSON);
        JSONArray movies = jsonResponse.getJSONArray("characters");
        String hey = movies.toString();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }