0
     String response = "{\"mon\" : [[16,20]],\"sun\":[[10,20]]}";

Basically, how do I get one object of 2 items where in each item is an int array of 2 elements. Sample code please.

        JSONArray jsonArray = jsonObject.getJSONArray("mon");
        JSONArray weekdayArray = jsonArray.getJSONArray(0);

        int size = weekdayArray.length();
        String weekday[] = new String[size];
        int[] wday = new int[size];
        for(int i=0; i < size ; i++) {
            weekday[i] = weekdayArray.getString(i);
            wday[i] = Integer.parseInt(weekday[i]);
        }
Pipedrive
  • 1
  • 1
  • 2
    See http://stackoverflow.com/questions/2591098/how-to-parse-json-in-java . You could also use a regular expression https://docs.oracle.com/javase/tutorial/essential/regex/ if the JSON structure is always the same – Parker Hoyes Aug 28 '15 at 01:06
  • It is an array of 2 items where in each item is an array of 2 elements. – Pipedrive Aug 28 '15 at 01:33
  • Here's something to get you on your feet: http://pastebin.com/TbG4dBUz – Parker Hoyes Aug 28 '15 at 01:57

1 Answers1

0

Where you get this json? because this json format is incorrect,if you necessary validate this json , access the http://json.parser.online.fr/ e paste your json e verify if this json is correct.