title: Retrieving specific fields from JSON file in Java
body: <p>I am trying to retrieve specific fields from a <a href="http://api.wunderground.com/api/a21d4c37b507ea76/conditions/forecast/q/19104.json" rel="nofollow">JSON file</a> that is being retrieved from Wunderground.com. </p>
  
  <p>I tried to post the relevant information in this, but couldn't get it formatted correctly. I am trying to retrieve the longitude and latitude, under the "current_observation" section. I am using Gson 2.2.4. This is the code I currently have:</p>
  
  <pre><code>    String key = "aaaaaaaaaaaaaaaa";
      String sURL = "http://api.wunderground.com/api/" + key + "/conditions/forecast/q/19104.json";
  
      URL url = new URL(sURL);
      URLConnection request = (URLConnection) url.openConnection();
      request.connect();
  
      JsonParser jp = new JsonParser(); //from gson
      JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent()));
      JsonObject rootobj = root.getAsJsonObject(); 
      JsonElement latitude = rootobj.get("current_observation");
  
      System.out.println(latitude);
  </code></pre>
  
  <p>This currently gets everything under the "current_observation" tag, and prints it to the screen. I can not figure out how to access anything under that. I saw several posts on here about using a JsonArray, but no matter what I tried, I could not get it to work correctly. So how do I retrieve a specific field from a JSON file? Thank you for any guidance you can give me, and please let me know if I should provide any additional information.</p>