Dears, I need to transform the Covid hospitalisation json data from the government webpage: https://onemocneni-aktualne.mzcr.cz/covid-19#panel3-hospitalization
I inspect the webpage and identified the table in the below-showed html code.
I used the following Python code and got the outcome below:
import bs4 as bs
import urllib.request
import json
source = urllib.request.urlopen("https://onemocneni-aktualne.mzcr.cz/covid-19#panel3-hospitalization")
soup = bs.BeautifulSoup(source)
js_test = soup.find("div", id="js-hospitalization-table-data")
#Convert to JSON object
jsonData = json.loads(js_test.attrs["data-table"])
print (jsonData['body'])
Thank you.
data-tableis in JSON format, so you would need to convert data in that format into CSV — which may or may not be possible because the latter doesn't support nested data structures while the other does.data-tablefrom it or what it's returning, then I might be able to help convert it into CSV format.