5
I am trying to make a list of currencies from a JSON text, for this I am using the API "exchangeratesapi.io".
Using Javascript I achieved some success:
const url = 'https://api.exchangeratesapi.io/latest?base=USD'
fetch(url)
.then(result => result.json())
.then(json => console.log(json.rates))
But I would like to create a list with only the abbreviated names of the coins, for example:
{
BGN,
NZD,
ILS,
RUB,
CAD,
USD,
PHP,
CHF,
AUD,
JPY,
TRY,
HKD,
MYR,
HRK,
CZK,
IDR,
DKK,
NOK,
HUF,
GBP,
MXN,
THB,
ISK,
ZAR,
BRL,
SGD,
PLN,
INR,
KRW,
RON,
CNY,
SEK,
EUR
}
Or even create an array containing all of them from there, for example:
let currency = ["BGN", "NZD", "ILS", "RUB", "CAD", "USD", "PHP", "CHF", "AUD", "JPY", "TRY", "HKD", "MYR", "HRK", "CZK", "IDR", "DKK", "NOK", "HUF", "GBP", "MXN", "THB", "ISK", "ZAR", "BRL", "SGD", "PLN", "INR", "KRW", "RON", "CNY", "SEK", "EUR"];
What technologies or methods should I use to achieve this?