想要计算** monthly_engagement_info **中的总OBJECTS,它有2个对象,但我想按计算进行计数

时间:2017-10-09 06:35:05

标签: android arrays json parsing

  

想要计算 monthly_engagement_info 中的总OBJECTS,它有2个对象,但我想按计算进行计数。

  {

 "status": {

"monthly_engagement_info": [
  {

    "ride_description_title": "Home Address",
    "ride": "Home"

  },
  {      
    "ride_description_title": "Home Address"
  }
]
}

 }

1 个答案:

答案 0 :(得分:2)

    String response="you response";
    JSONObject object=new JSONObject(response);
    JSONArray arrayInfo=object.getJSONArray("monthly_engagement_info");
    Log.d(" size of info"," size= "+arrayInfo.length()); // here get size