Jump to content

Extracting values from json objects


Recommended Posts


I have just starting doing react and I have the following function which pass 4 values to the API to obtain data objects.

let ratesData = getRatesFromDates(startDateRate, endDateRate, baseCurrency, targetCurrency);
  async function getRatesFromDates(startDate, endDate, baseCurrency, targetCurrency) {
    try {
      let response = await fetch('https://api.exchangeratesapi.io/history?start_at=' +
                                    startDate + '&end_at=' + endDate + '&symbols=' + baseCurrency + ',' + targetCurrency);
      let jsonData = await response.json();
      return jsonData.rates;
     } catch(error) {

In console, these are the data obtained.


I am wondering how I can loop through these data to make use and display them on the webpage or pass certain values to other functions?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...