-2

How to fetch Keys inside date arrays i am able to parse till '2'how to get that 19:00:00

 "date_times": {
          "2": {
            "2018-01-08": [
              **"19:00:00"**
            ],
            "2018-01-09": [
              "13:30:00",
              "19:00:00"
            ],
            "2018-01-10": [
              "13:30:00",
              "19:00:00"
            ],
            "2018-01-11": [
              "13:30:00",
              "19:00:00"
            ]
          }
        }
Rahul
  • 32
  • 6
  • @Rahul, Please refer to this [question](https://stackoverflow.com/questions/4407532/parse-json-object-with-string-and-value-only). – Jay Jan 08 '18 at 13:23
  • What you means by this ? this question related to json parsing . isn't it ? is this JSOn is valid . Add a valid json – ADM Jan 08 '18 at 13:25

1 Answers1

1

If you concern about getting keys from jsonobject . Then just use an Iterator on keys.

 try {
        JSONObject resObject = new JSONObject(response);
        Iterator<String> iterator = resObject.keys();
        while (iterator.hasNext()) {
            String key = iterator.next();// this will be your date
            JSONArray data = resObject.getJSONArray(key);// And this is your data

        }
    } catch (Exception e) {
    }

This is just an example modify it as per your need

ADM
  • 20,406
  • 11
  • 52
  • 83