0

おはようございます、このエラーのせいで頭が爆発しそうです

タイプ org.json.JSONObject の poiComment の値 {...} は JSONArray に変換できません

これはjsonファイルです:

    {
    "poiComment": [
        {
            "id": "1",
            "poiComment": "I'm at The Pine. http://4sq.com/a1UXvc"
        },
        {
            "id": "2",
            "poiComment": "bday dinner w. my bff <3 (@ The Pine) http://4sq.com/a1UXvc"
        },
        {
            "id": "3",
            "poiComment": "I'm at The Pine. http://4sq.com/a1UXvc"
        }
    ]
}

そして私はこのように使用します(前回はjsonobjectを使用しました):

JSONObject jso1 = new JSONObject(response1);
JSONArray jArray1 = jso1.getJSONArray("poiComment");

それはどのように可能ですか??

助けてくれてありがとう

これはパーサーが行うことです

private String inputStreamToString(InputStream is) {

        String line = "";
        StringBuilder total = new StringBuilder();

        // Wrap a BufferedReader around the InputStream
        BufferedReader rd = new BufferedReader(new InputStreamReader(is));

        try {
            // Read response until the end
            while ((line = rd.readLine()) != null) {
                total.append(line);
            }
        } catch (IOException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
        }

        // Return full string
        return total.toString();
    }

これはパーサーが生成するものです!!!????!!!!??! どのように可能ですか?:(

 {"poiComment":{"id":"1","poiComment":"Nadoori no more. Watching peeps plan a new restaurant, Yuba (@ Nadoori) http://4sq.com/8yVoey"}}
4

0 に答える 0