I have two JSON files.
one looks like this:
{
base: "EUR",
date: "2019-01-30",
rates: {
USD: 1.1429,
AND MORE....
...
...
}
}
and another one that looks like this:
{
results: {
USD: {
currencyName: "United States Dollar",
currencySymbol: "$",
id: "USD"
}
}
I want to combine them together and get an object that looks like this:
{
results: {
USD: {
currencyName: "United States Dollar",
currencySymbol: "$",
id: "USD",
value: 1.1429 <====== the change
}
}
I couldn't find anything similar here... and have no idea how to begin
I am getting the values from these links:
https://free.currencyconverterapi.com/api/v6/currencies
https://api.exchangeratesapi.io/latest
with fetch function:
function getdataFromApiAsync() {
return fetch('https://api.exchangeratesapi.io/latest')
.then((response) => response.json())
.then((responseJson) => {
return responseJson.rates;
})
.catch((error) => {
console.error(error);
});
}