This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Json and data
#6
(17.03.2020, 10:10)tomnord Wrote: Thanks, so I've gotten a bit further, but not quite there.
I am now reading the decoded json from string, but now I'm stuck at setting up import from this URL:
https://www.vg.no/spesial/2020/corona-vi...-overview/


got it:

require('ssl.https')
require('json')
data = ssl.https.request("https://www.vg.no/spesial/2020/corona-viruset/data/norway-table-overview/")
dec = json.decode(data)
confirmed= dec["cases"][4]["confirmed"]
log(confirmed)
try this, 

Code:
log(dec.totals.confirmed)
--instead of confirmed= dec["cases"][4]["confirmed"] use,

confirmed = dec.totals.confirmed
log(confirmed)

or log(dec.cases[4].confirmed)
Reply


Messages In This Thread
Json and data - by tomnord - 15.03.2020, 17:02
RE: Json and data - by benanderson_475 - 15.03.2020, 21:14
RE: Json and data - by tomnord - 17.03.2020, 10:10
RE: Json and data - by benanderson_475 - 17.03.2020, 19:31
RE: Json and data - by AlexLV - 17.03.2020, 16:45
RE: Json and data - by Daniel - 17.03.2020, 17:03
RE: Json and data - by AlexLV - 17.03.2020, 19:57
RE: Json and data - by benanderson_475 - 17.03.2020, 20:03
RE: Json and data - by Daniel - 17.03.2020, 21:04
RE: Json and data - by AlexLV - 18.03.2020, 08:42
RE: Json and data - by Daniel - 18.03.2020, 08:53
RE: Json and data - by admin - 18.03.2020, 09:25

Forum Jump: