I'm trying to get JSON data in excel and parse it. However, I'm getting an error: Type Mismatch.
Does anyone know how I can resolve this? I can't figure out what I'm doing wrong.
This is the link to the API I'm using: https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD
Here is the code:
Public Sub exceljson()
Dim https As Object, JSON As Object, i As Integer
Set https = CreateObject("MSXML2.XMLHTTP")
https.Open "GET", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD", False
https.Send
Set JSON = ParseJson(https.responseText)
i = 2
For Each Item In JSON
Sheets(1).Cells(i, 1).Value = Item("USD")
i = i + 1
Next
MsgBox ("complete")
End Sub
Debug.Print Item, JSON(Item)
– Tim Williams