This is my JSON structure:
{
"Realtime Currency Exchange Rate": {
"1. From_Currency Code": "AUD",
"2. From_Currency Name": "Australian Dollar",
"3. To_Currency Code": "USD",
"4. To_Currency Name": "United States Dollar",
"5. Exchange Rate": "0.70856660",
"6. Last Refreshed": "2018-10-23 17:37:03",
"7. Time Zone": "UTC"
}
}
The code I'm using:
Dim scriptControl As Object
Set scriptControl = CreateObject("MSScriptControl.ScriptControl")
scriptControl.Language = "JScript"
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "https://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE&from_currency=AUD&to_currency=USD&apikey=demo", False
.send
scriptControl.Eval "var obj=(" & .responseText & ")"
End With
How can I access values in VBA? For example, if I want to access "5. Exchange Rate" value, what should I do?
I tried many variations using [] and (), but nothing works for me.
Thank you.