0

{ "data:" { "calendar": [ { "Booked":["13-11-2015","12-12-2015"], "Available":["20-12-2015","22-12-2015"] } ] } }

Could any one please help me how to get date from json array string

HalAndroid
  • 45
  • 1
  • 3

1 Answers1

2

Your json should be like this

{
  "data": {
    "calendar": [
      {
        "Booked": [
          "13-11-2015",
          "12-12-2015"
        ],
        "Available": [
          "20-12-2015",
          "22-12-2015"
        ]
      }
    ]
  }
}

You can use json online parser to check the validity of a json.

Now, coming back to your actual question.I dont have an android IDE so I will post a quick code to give u an idea

JSONObject jparentobj= new JSONObect("jsonString");

JSONObject datajObj= jparentobj.getJSONObect("data");

JSONArray calenderarray = datajObj.getJSONArray{"calender");

for (int i = 0; i < calenderarray.size(0); i++){
String booked = calenderarray.get(i).getString("Booked");
//Like this get each entity

}

Hope this helps you..

Abx
  • 2,852
  • 4
  • 30
  • 50