title: How to Return Nested Values from Complicated JSON API
body: <p>I am setting up a weather camera which will provide a live stream of the current conditions outside, but I also would like to overlay continuously updated weather conditions (temperature, wind speed/direction, current weather) from a local National Weather Service weather station, from a browser API source provided in JSON format.</p>
  
  <p>I have had success extracting the desired values from a different API source using a Python script I wrote; however long story short that API source is unreliable. Therefore I am using API from the official National Weather Service ASOS station at my nearby airport. The output from the new API source I am polling from is rather complicated, however, with various tiers of indentation. I have not worked with Python very long and tutorials and guides online have either been for other languages (Java or C++ mostly) or have not worked for my specific case. </p>
  
  <p>First off, here is the structure of the JSON that I am receiving:</p>
  
  <p><a href="https://i.stack.imgur.com/w5owA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w5owA.png" alt="screenshot of JSON structure"></a></p>
  
  <p>I underlined the values I am trying to extract. They are listed under the <code>OBSERVATIONS</code> section, associated with <code>precip_accum_24_hour_value_1</code>, <code>wind_gust_value_1</code>, <code>wind_cardinal_direction_value_1d</code>, and so on. The issue is there are two values underneath each observation so the script I have tried isn't returning the values I want. Here is the code I have tried:</p>
  
  <pre><code>import urllib.request
  import json
  
  f = urllib.request.urlopen('https://api.synopticdata.com/v2/stations/latest?token=8c96805fbf854373bc4b492bb3439a67&amp;stid=KSTC&amp;complete=1&amp;units=english&amp;output=json')
  
  json_string = f.read()
  parsed_json = json.loads(json_string)
  
  for each in parsed_json['STATION']:
      observations = each['OBSERVATIONS']
  
  print(observations)
  </code></pre>
  
  <p>This prints out everything underneath the <code>OBSERVATIONS</code> in the JSON as expected, as one long string. </p>
  
  <pre><code>{'precip_accum_24_hour_value_1': {'date_time': '2018-12-06T11:53:00Z', 'value': 0.01}, 'wind_gust_value_1': {'date_time': '2018-12-12T01:35:00Z', 'value': 14.0}, 
  </code></pre>
  
  <p>to show a small snippet of the output I am receiving. I was hoping I could individually extract the values I want from this string, but everything I have attempted is not working. I would really appreciate some guidance for finishing this piece of code so I can return the values I am looking for. I realize it may be some kind of loop or special syntax. </p>