# Json parse

**URL:** <https://forum.inductiveautomation.com/t/json-parse/12499>\
**Category:** Ignition\
**Created:** [December 25, 2016, 10:21pm UTC](https://forum.inductiveautomation.com/t/json-parse/12499 "2016-12-25T22:21:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose.granero](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jose.granero/32/11190_2.png) [@jose.granero](https://forum.inductiveautomation.com/u/jose.granero)\
**Post date:** [December 25, 2016, 10:21pm UTC](https://forum.inductiveautomation.com/t/json-parse/12499/1 "2016-12-25T22:21:28Z")

</div>

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](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](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](http://icons.wxug.com/graphics/wu2/logo_130x80.png)”,  
“title”:“Weather Underground”,  
“link”:“[http://www.wunderground.com](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](http://icons.wxug.com/i/c/k/nt_clear.gif)”,  
“forecast\_url”:“[http://www.wunderground.com/global/stations/08221.html](http://www.wunderground.com/global/stations/08221.html)”,  
“history\_url”:“[http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IMADRID429](http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IMADRID429)”,  
“ob\_url”:“[http://www.wunderground.com/cgi-bin/findweather/getForecast?query=40.449646,-3.657716](http://www.wunderground.com/cgi-bin/findweather/getForecast?query=40.449646,-3.657716)”,  
“nowcast”:""  
}  
}

---

<div class="post-metadata">

**Author:** ![jose.granero](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jose.granero/32/11190_2.png) [@jose.granero](https://forum.inductiveautomation.com/u/jose.granero)\
**Post date:** [December 26, 2016, 12:40pm UTC](https://forum.inductiveautomation.com/t/json-parse/12499/2 "2016-12-26T12:40:25Z")

</div>

import re  
source = system.net.httpGet(“[http://api.wunderground.com/api/567cb0c9feac3a71/conditions/q/pws:IMADRID429.json](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))
