Hello everyone,
I need to extract one value from two different Web Dat API in JSON:
First one:
{"current":{"ts":"2018-09 19T10:56:59.869Z","tp":25.8,"hm":53,"p2":11,"p1":17,"co":575},
"historical":{"instant":[{"ts":"2018-09-19T10:56:59.869Z","tp":25.8,"hm":53,"p2":11,"p1":17,"co":575},{"ts":"2018-09-19T10:55:59.882Z","tp":25.8,"hm":53,"p2":10,"p1":11,"co":575},{"ts":"2018-09-19T10:55:00.537Z","tp":25.7,"hm":53,"p2":12,"p1":21,"co":575},{"ts":"2018-09-19T10:53:59.865Z","tp":25.8,"hm":53,"p2":11,"p1":15,"co":583}, ecc
Second one:
{"cod":"200","message":0.0047,"cnt":40,"list":[{"dt":1537358400,"main":{"temp":290.52,"temp_min":290.52,"temp_max":291.333,"pressure":974.52,"sea_level":1027.16,"grnd_level":974.52,"humidity":95,"temp_kf":-0.81},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":1.36,"deg":339},"rain":{"3h":0.065},"sys":{"pod":"d"},"dt_txt":"2018-09-19 12:00:00"},{"dt":1537369200,"main":{"temp":291.76,"temp_min":291.76,"temp_max":292.365,"pressure":975.68,"sea_level":1028.4,"grnd_level":975.68,"humidity":84,"temp_kf":-0.61},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":88},"wind":{"speed":1.76,"deg":2.00037},"rain":{"3h":0.0575},"sys":{"pod":"d"},"dt_txt":"2018-09-19 15:00:00"},{"dt":1537380000,"main":{"temp":293.26,"temp_min":293.26,"temp_max":293.671,"pressure":976,"sea_level":1028.52,"grnd_level":976,"humidity":75,"temp_kf":-0.41},ecc
I need only the current temp that I generate with the Fetch on the web Data and I would like with a Dat Execute to update a Table only with the current temperature.
I try to understand and code all the suggestion that I find online and on this forum but I don’t understand where it’s my mistake or errors (newbie with this kind of operation).
I leave here my code for the first one:
[code]import json
Temp = op(‘jsonObj’)
def tableChange(dat):
Temp.clear()
stringVar = ‘{“tp”:“value”}’
jsonObj = json.loads(stringVar)
Temp.appendRow(jsonObj[‘tp’])[/code]
Hope some one of you can help me out
Thank you in advance