Hi sirs
i want to catch data from "https://www.twse.com.tw/rwd/zh/afterTrading/MI_INDEX?date=20240327&type=ALLBUT0999&response=json&_=1711564048882"
i try to use JsonConverte, but it show run-time error "450", but i check ResponseText correct. what mistake in this case ?? code like list, thanks
Sub FetchAndParseData_1()
Dim xhr As Object
Dim URl As String
Dim response As String
Dim json As Object
Dim tables As Object
Dim data As Object
URl = "https://www.twse.com.tw/rwd/zh/afterTrading/MI_INDEX?date=20240327&type=ALLBUT0999&response=json&_=1711564048882"
Set xhr = CreateObject("MSXML2.XMLHTTP")
xhr.Open "GET", URl, False
xhr.send
response = xhr.ResponseText
' Parse JSON response
Set json = JsonConverter.ParseJson(response)
Debug.Print json("tables") 'this show run-time error
' Check if JSON contains "tables" key
If json.Exists("tables") Then
Set tables = json("tables")
Set data = tables(8)("data")
Debug.Print json("tables")
Else
MsgBox "No tables found in JSON response."
End If
' Clean up
Set xhr = Nothing
End Sub