Ich versuche in VBA auf mehr als 508 "tank_id" s aus einer JSON-Datei as you can see here zuzugreifen.VBA-Zugriff auf eine JSON-Eigenschaft ohne Namenseigenschaft
Ich benutze cStringBuilder, cJSONScript und JSONConverter, um die JSON-Datei zu analysieren.
Mein Hauptproblem ist, dass ich nicht all diese IDs übergeben kann, weil ich nicht weiß, wie man die "1" "33" "49" "81" bekommt, die ohne Namen sind.
Hier ist der Code Ich habe versucht, sie zu bekommen, ohne Erfolg.
Const myurl2 As String = "https://api.worldoftanks.eu/wot/encyclopedia/vehicles/?application_id=demo&fields=tank_id"
Sub List_id_vehicules()
Dim strRequest
Dim xmlHttp: Set xmlHttp = CreateObject("msxml2.xmlhttp")
Dim response As Object
Dim rows As Integer
Dim counter As Integer
Dim j As String
Dim k As Integer: k = 2
Dim url As String
url = myurl2
xmlHttp.Open "GET", url, False
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.send
While Not xmlHttp.Status = 200 '<---------- wait
Wend
Set response = ParseJson(xmlHttp.ResponseText)
rows = response("meta")("count")
For counter = 1 To rows
j = counter
Dim yop As String
yop = "data[" & j & "][" & j & "]"
Sheets(2).Cells(1 + counter, 1).Value = response('data[counter]')['tank_id']
Next counter
END Sub
Könnte mir jemand helfen?
Es funktioniert großartig für das, was ich wollte. Ich bin dir so dankbar, dass du mir geholfen hast. Ein riesiges Dankeschön. Tatsache war, dass ich nicht wusste, wie man Wörterbuch verwendet. Habe jetzt ein Beispiel. –