Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Is there a way to fetch needed information from JSON file in React Native

$
0
0

I am using a COVID-19 API (https://api.covidactnow.org/v2/counties.json?apiKey=) that records various information like number of cases and deaths in each county in USA. In my React Native app, I retrieved the user's location, and more specifically, the user's county, state and country. In this case, I have stored the user's county name in countyName. I'd like to fetch the specific cases and deaths from the JSON file depending on what is countyName is. I have a snippet of one county in the JSON file below. I was thinking I could go into the index of the array and in the actuals, and then fetch the cases and deaths.

[  {"fips": "02013","country": "US","state": "AK","county": "Aleutians East Borough","level": "county","lat": null,"locationId": "iso1:us#iso2:us-ak#fips:02013","long": null,"population": 3337,"metrics": {"testPositivityRatio": null,"testPositivityRatioDetails": {"source": "other"      },"caseDensity": 0,"contactTracerCapacityRatio": null,"infectionRate": 4.71887277063,"infectionRateCI90": 1.1615979428900003,"icuHeadroomRatio": null,"icuHeadroomDetails": null,"icuCapacityRatio": null,"vaccinationsInitiatedRatio": null,"vaccinationsCompletedRatio": 0.27509739286784535    },"riskLevels": {"overall": 0,"testPositivityRatio": 4,"caseDensity": 0,"contactTracerCapacityRatio": 4,"infectionRate": 3,"icuHeadroomRatio": 4,"icuCapacityRatio": 4    },"actuals": {"cases": 363,"deaths": 2,"positiveTests": null,"negativeTests": null,"contactTracers": null,"hospitalBeds": {"capacity": null,"currentUsageTotal": null,"currentUsageCovid": null,"typicalUsageRate": null      },"icuBeds": {"capacity": null,"currentUsageTotal": null,"currentUsageCovid": null,"typicalUsageRate": null      },"newCases": 0,"newDeaths": 0,"vaccinesDistributed": null,"vaccinationsInitiated": null,"vaccinationsCompleted": 918,"vaccinesAdministered": null,"vaccinesAdministeredDemographics": null,"vaccinationsInitiatedDemographics": null    },"annotations": {"cases": {"sources": [          {"type": "NYTimes","url": "https://github.com/nytimes/covid-19-data","name": "The New York Times"          }        ],"anomalies": []      },"deaths": {"sources": [          {"type": "NYTimes","url": "https://github.com/nytimes/covid-19-data","name": "The New York Times"          }        ],"anomalies": []      },"positiveTests": null,"negativeTests": null,"contactTracers": null,"hospitalBeds": null,"icuBeds": null,"newCases": null,"newDeaths": null,"vaccinesDistributed": null,"vaccinationsInitiated": null,"vaccinationsCompleted": {"sources": [          {"type": "other","url": "https://covid.cdc.gov/covid-data-tracker/#county-view","name": "Centers for Disease Control and Prevention"          }        ],"anomalies": []      },"vaccinesAdministered": null,"testPositivityRatio": null,"caseDensity": {"sources": [          {"type": "NYTimes","url": "https://github.com/nytimes/covid-19-data","name": "The New York Times"          }        ],"anomalies": []      },"contactTracerCapacityRatio": null,"infectionRate": {"sources": [          {"type": "NYTimes","url": "https://github.com/nytimes/covid-19-data","name": "The New York Times"          }        ],"anomalies": []      },"infectionRateCI90": {"sources": [          {"type": "NYTimes","url": "https://github.com/nytimes/covid-19-data","name": "The New York Times"          }        ],"anomalies": []      },"icuHeadroomRatio": null,"icuCapacityRatio": null,"vaccinationsInitiatedRatio": null,"vaccinationsCompletedRatio": null    },"lastUpdatedDate": "2021-04-26","url": "https://covidactnow.org/us/alaska-ak/county/aleutians_east_borough"  },

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>