如何将此 json [Blogger] 解析为 android

how to parse this json [Blogger] to android

我在将此博主 JSON 文件解析为 android 时遇到问题 blogger JSON structure

我想在字符串变量中显示标题请帮助我

我试过这个代码

@Override
    protected Boolean doInBackground(String... urls) {
        try {

            //------------------>>
            HttpGet httppost = new HttpGet(urls[0]);
            HttpClient httpclient = new DefaultHttpClient();
            HttpResponse response = httpclient.execute(httppost);

            // StatusLine stat = response.getStatusLine();
            int status = response.getStatusLine().getStatusCode();

            if (status == 200) {
                HttpEntity entity = response.getEntity();
                String data = EntityUtils.toString(entity);


                JSONObject jsono = new JSONObject(data);
                JSONArray jarray = jsono.getJSONObject("feed").getJSONArray("entry");

                for (int i = 0; i < jarray.length(); i++) {
                    JSONObject object = jarray.getJSONObject(i);

                    Actors actor = new Actors();

                    actor.setName(object.getString("title"));



                    actorsList.add(actor);
                }
                return true;
            }

            //------------------>>

        } catch (ParseException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return false;
    }

我必须将上面嵌套的 JSON 数组的数据解析到我的应用程序中。我很困惑如何从中获取值。

entry 不在根对象中,而是在 feed 对象中,所以使用

//...
JSONObject jsono = new JSONObject(data);
JSONArray jarray = jsono.getJSONObject("feed").getJSONArray("entry");
//...