Json parse

Hi all,

I’m trying to parse the json file shown below in order to get the ‘temp_c’ value, however the returned file is a string instead of a list and I’m stuck. Can anyone give me a hand?.

source = system.net.httpGet(“http://api.wunderground.com/api/567cb0c9feac3a71/conditions/q/pws:IMADRID429.json”)
data=system.util.jsonDecode(source)
print type(data)

{
“response”: {
“version”:“0.1”,
“termsofService”:“http://www.wunderground.com/weather/api/d/terms.html”,
“features”: {
“conditions”: 1
}
}
, “current_observation”: {
“image”: {
“url”:“http://icons.wxug.com/graphics/wu2/logo_130x80.png”,
“title”:“Weather Underground”,
“link”:“http://www.wunderground.com
},
“display_location”: {
“full”:“Madrid, Spain”,
“city”:“Madrid”,
“state”:“M”,
“state_name”:“Spain”,
“country”:“SP”,
“country_iso3166”:“ES”,
“zip”:“00000”,
“magic”:“1”,
“wmo”:“08221”,
“latitude”:“40.449646”,
“longitude”:"-3.657716",
“elevation”:“609.0”
},
“observation_location”: {
“full”:“Calle de Torrelaguna, Madrid, “,
“city”:“Calle de Torrelaguna, Madrid”,
“state”:””,
“country”:"",
“country_iso3166”:“ES”,
“latitude”:“40.449646”,
“longitude”:"-3.657716",
“elevation”:“2286 ft”
},
“estimated”: {
},
“station_id”:“IMADRID429”,
“observation_time”:“Last Updated on December 25, 8:32 PM CET”,
“observation_time_rfc822”:“Sun, 25 Dec 2016 20:32:34 +0100”,
“observation_epoch”:“1482694354”,
“local_time_rfc822”:“Sun, 25 Dec 2016 20:41:36 +0100”,
“local_epoch”:“1482694896”,
“local_tz_short”:“CET”,
“local_tz_long”:“Europe/Madrid”,
“local_tz_offset”:"+0100",
“weather”:“Clear”,
“temperature_string”:“48.4 F (9.1 C)”,
“temp_f”:48.4,
“temp_c”:9.1,
“relative_humidity”:“73%”,
“wind_string”:“Calm”,
“wind_dir”:“North”,
“wind_degrees”:-9999,
“wind_mph”:-9999.0,
“wind_gust_mph”:0,
“wind_kph”:0,
“wind_gust_kph”:0,
“pressure_mb”:“1032”,
“pressure_in”:“30.48”,
“pressure_trend”:“0”,
“dewpoint_string”:“40.2 F (4.6 C)”,
“dewpoint_f”:40.2,
“dewpoint_c”:4.6,
“heat_index_string”:“NA”,
“heat_index_f”:“NA”,
“heat_index_c”:“NA”,
“windchill_string”:“NA”,
“windchill_f”:“NA”,
“windchill_c”:“NA”,
“feelslike_string”:“48.4 F (9.1 C)”,
“feelslike_f”:“48.4”,
“feelslike_c”:“9.1”,
“visibility_mi”:“N/A”,
“visibility_km”:“N/A”,
“solarradiation”:"–",
“UV”:"-1",“precip_1hr_string”:"-999.00 in (-2537.5 mm)",
“precip_1hr_in”:"-999.00",
“precip_1hr_metric”:"–",
“precip_today_string”:“0.00 in (0 mm)”,
“precip_today_in”:“0.00”,
“precip_today_metric”:“0”,
“icon”:“clear”,
“icon_url”:“http://icons.wxug.com/i/c/k/nt_clear.gif”,
“forecast_url”:“http://www.wunderground.com/global/stations/08221.html”,
“history_url”:“http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IMADRID429”,
“ob_url”:“http://www.wunderground.com/cgi-bin/findweather/getForecast?query=40.449646,-3.657716”,
“nowcast”:""
}
}

import re
source = system.net.httpGet(“http://api.wunderground.com/api/567cb0c9feac3a71/conditions/q/pws:IMADRID429.json”)
s=system.util.jsonDecode(source)
result=re.search(’“temp_c”:(.*),’, s)
temp_ext=float(result.group(1))