Omaroid / Covid-19-API

A realtime API for coronavirus cases on Heroku. Data automatically updated every 10 minutes!
https://covid19api.herokuapp.com/
MIT License
59 stars 10 forks source link

Getting Invalid Json format #14

Open utsabc opened 3 years ago

utsabc commented 3 years ago

Getting JSON format issue because of NaN values in some of the latitudes and longitudes. You could do a check before setting value into the latitudes and longitudes as you already have templated it as "nan"

"latest":306385,"province":"Quebec"},{"coordinates":{"latitude":NaN,"longitude":NaN},"country":"Canada",

Screenshot 2021-03-27 at 10 00 15 PM
utsabc commented 3 years ago

Getting JSON format issue because of NaN values in some of the latitudes and longitudes. You could do a check before setting value into the latitudes and longitudes as you already have templated it as "nan"

"latest":306385,"province":"Quebec"},{"coordinates":{"latitude":NaN,"longitude":NaN},"country":"Canada",

Screenshot 2021-03-27 at 10 00 15 PM

Possible solution: refresh.py

 if not math.isnan(row['Lat']):
       tmp_country_position['latitude'] = row['Lat']
 if not math.isnan(row['Long']):
       tmp_country_position['longitude'] = row['Long']