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

1
  • This is a invalid json array Commented Nov 20, 2015 at 5:37

1 Answer 1

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..

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.