title: org.json.JSONException: JSONObject["weather"] is not a string
body: <p>I am currently using a weather API from <a href="https://openweathermap.org/api" rel="nofollow noreferrer">https://openweathermap.org/api</a> and I'm trying to convert a JSON page into printable strings. To be more specific. Im tryying to print out the Array of "weather" as the key but its not working:</p>
  
  <pre><code>
  import org.apache.http.HttpEntity;
  import org.apache.http.ParseException;
  import org.apache.http.client.methods.CloseableHttpResponse;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.CloseableHttpClient;
  import org.apache.http.impl.client.HttpClients;
  import org.apache.http.util.EntityUtils;
  import org.json.JSONObject;
  
  public class Main {
  
      public static void main(String[] args) throws ParseException, org.json.simple.parser.ParseException {
          String URL = "http://api.openweathermap.org/data/2.5/weather?q=miami&amp;appid=2550e0628a9e7428e4ef85626feb1c95";
          CloseableHttpClient httpclient = HttpClients.createDefault();
          HttpGet getURL = new HttpGet(URL);
          try {
              CloseableHttpResponse response1 = httpclient.execute(getURL);
              HttpEntity entity = response1.getEntity();
              JSONObject json = new JSONObject(EntityUtils.toString(entity));
              json.getString("weather");
          } catch (IOException e) {
              System.out.println("Failed");
          }
      }
  
  }
  </code></pre>
  
  <p>The JSONObject structure is this: </p>
  
  <pre><code>    "coord": {
          "lon": -80.19,
          "lat": 25.77
      },
      "weather": [{
          "id": 804,
          "main": "Clouds",
          "description": "overcast clouds",
          "icon": "04n"
      }],
      "base": "stations",
      "main": {
          "temp": 301.17,
          "feels_like": 303.16,
          "temp_min": 300.93,
          "temp_max": 301.48,
          "pressure": 1018,
          "humidity": 74
      },
      "visibility": 16093,
      "wind": {
          "speed": 4.6,
          "deg": 80
      },
      "clouds": {
          "all": 90
      },
      "dt": 1591061650,
      "sys": {
          "type": 1,
          "id": 4896,
          "country": "US",
          "sunrise": 1591007368,
          "sunset": 1591056495
      },
      "timezone": -14400,
      "id": 4164138,
      "name": "Miami",
      "cod": 200
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>    at org.json.JSONObject.wrongValueFormatException(JSONObject.java:2590)
      at org.json.JSONObject.getString(JSONObject.java:863)
      at Main.main(Main.java:23)
  </code></pre>
  
  <p>Im trying to get the "weather" section of the JSON or any sub section of the JSON. Could someone help me with my code?</p>