I am trying to select two values from a JSON response in VBA, using the JsonConverter.bas file from GitHub. I am not sure I am calling the fields correctly. When I run the following code I get the "Run-time error '13': Type mismatch" error message. How would I be able to select the max_price value and the min_price values from the following:
Public Sub exceljson()
Dim http As Object, JSON As Object, i As Integer
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", "https://testapp.deribit.com/api/v2/public/ticker?instrument_name=BTC-27DEC19-8000-C", False
http.Send
Set JSON = ParseJson(http.ResponseText)
i = 2
For Each Item In JSON
Sheets(1).Cells(i, 1).Value = Item("result")("max_price")
Sheets(1).Cells(i, 2).Value = Item("result")("min_price")
i = i + 1
Next
MsgBox ("complete")
End Sub