title: JSON data is read but cannot be converted to JSONArray
body: <p>I'm developing an app which reads JSON data. Json Data is parsed but it is not viewing in the listview. Logcat says about a type mismatch. I'm not that much familiar in Json.<br>
  <a href="http://api.openweathermap.org/data/2.5/forecast/daily?lat=6.421465&amp;lon=81.332396&amp;cnt=10&amp;mode=json" rel="nofollow">http://api.openweathermap.org/data/2.5/forecast/daily?lat=6.421465&amp;lon=81.332396&amp;cnt=10&amp;mode=json</a></p>
  
  <p>This is my logcat and code. Please hemp me with this. </p>
  
  <blockquote>
    <p>org.json.JSONException: Index 1 out of range [0..1)
    org.json.JSONArray.get(JSONArray.java:263)
    org.json.JSONArray.getString(JSONArray.java:421)
    com.is.parsej.ParseJ$GetContacts.doInBackground(ParseJ.java:141)
    com.is.parsej.ParseJ$GetContacts.doInBackground(ParseJ.java:1)
    android.os.AsyncTask$2.call(AsyncTask.java:287)
    java.util.concurrent.FutureTask.run(FutureTask.java:234)
    android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)</p>
  </blockquote>
  
  <pre><code>   public class ParseJ extends ListActivity {
  
           private ProgressDialog pDialog;
  
              // URL to get contacts JSON
              private static String url = "http://api.openweathermap.org/data/2.5/forecast/daily?lat=6.421465&amp;lon=81.332396&amp;cnt=10&amp;mode=json";
  
              // JSON Node names
              private static final String TAG_COd = "list"; //edited
              private static final String TAG_ID = "dt";    //edited
  
              private static final String TAG_WEATHER = "weather";
              private static final String TAG_MAIN = "main";
              private static final String TAG_DESC = "description";
  
              private static final String TAG_TEMP = "temp";
              private static final String TAG_DAY = "day";
              private static final String TAG_MIN = "min";
              private static final String TAG_MAX = "max";
              private static final String TAG_NIGHT = "night";
              private static final String TAG_MORN= "morn";
  
              private static final String TAG_HUMIDITY = "humidity";
  
              // contacts JSONArray
              JSONArray contacts = null;
  
              // Hashmap for ListView
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList;
  
              @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_parse_j);
  
                  contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
                  ListView lv = getListView();
  
                  // Listview on item click listener
                  lv.setOnItemClickListener(new OnItemClickListener() {
  
                      @Override
                      public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                              int position, long id) {
                          // getting values from selected ListItem
                          String weather = ((TextView) view.findViewById(R.id.main))
                                  .getText().toString();
                          String Temp = ((TextView) view.findViewById(R.id.Descrption))
                                  .getText().toString();
                          String Humidity = ((TextView) view.findViewById(R.id.temp))
                                  .getText().toString();
  
                          // Starting single contact activity
                          Intent in = new Intent(getApplicationContext(),
                                  SingleContactActivity.class);
                          in.putExtra(TAG_WEATHER, weather);
                          in.putExtra(TAG_TEMP, Temp);
                          in.putExtra(TAG_HUMIDITY, Humidity);
                          startActivity(in);
  
                      }
                  });
  
                  // Calling async task to get json
                  new GetContacts().execute();
              }
  
              /**
               * Async task class to get json by making HTTP call
               * */
              private class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; {
  
                  @Override
                  protected void onPreExecute() {
                      super.onPreExecute();
                      // Showing progress dialog
                      pDialog = new ProgressDialog(ParseJ.this);
                      pDialog.setMessage("Please wait...");
                      pDialog.setCancelable(false);
                      pDialog.show();
  
                  }
  
                  @Override
                  protected Void doInBackground(Void... arg0) {
                      // Creating service handler class instance
                      ServiceHandler sh = new ServiceHandler();
  
                      // Making a request to url and getting response
                      String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
  
                      Log.d("Response: ", "&gt; " + jsonStr);
  
                      if (jsonStr != null) {
                          try {
                              JSONObject jsonObj = new JSONObject(jsonStr);
  
                              // Getting JSON Array node
                              contacts = jsonObj.getJSONArray(TAG_COd);
  
                              // looping through All Contacts
                              for (int i = 0; i &lt; contacts.length(); i++) {
                                  JSONObject c = contacts.getJSONObject(i);
  
                                  String id = c.getString(TAG_ID);
                                  String humidity = c.getString(TAG_HUMIDITY);
  
                                  // Phone node is JSON Object
                                  JSONObject temp = c.getJSONObject(TAG_TEMP);
                                  String day = temp.getString(TAG_DAY);
                                  String maxTemp = temp.getString(TAG_MAX);
                                  String minTemp = temp.getString(TAG_MIN);
                                  String morningTemp = temp.getString(TAG_MORN);
                                  //edited
                                  JSONArray weather = c.getJSONArray(TAG_WEATHER);
                                  String main = weather.getString(1);
                                  String desc = weather.getString(2); 
  
                                  // tmp hashmap for single contact
                                  HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;();
  
                                  // adding each child node to HashMap key =&gt; value
                                  contact.put(TAG_ID, id);
                                  contact.put(TAG_DAY, day);
                                  contact.put(TAG_DESC, desc);
                                  contact.put(TAG_HUMIDITY, humidity);
  
                                  // adding contact to contact list
                                  contactList.add(contact);
                              }
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
                      } else {
                          Log.e("ServiceHandler", "Couldn't get any data from the url");
                      }
  
                      return null;
                  }
  
                  @Override
                  protected void onPostExecute(Void result) {
                      super.onPostExecute(result);
                      // Dismiss the progress dialog
                      if (pDialog.isShowing())
                          pDialog.dismiss();
                      /**
                       * Updating parsed JSON data into ListView
                       * */
                      ListAdapter adapter = new SimpleAdapter(
                              ParseJ.this, contactList,
                              R.layout.list_item, new String[] { TAG_DAY, TAG_DESC,
                                      TAG_HUMIDITY }, new int[] { R.id.temp,
                                      R.id.main, R.id.Descrption });
  
                      setListAdapter(adapter);
                  }
  
              }
  
          }
  </code></pre>