此问题已在此处有答案:
Parsing JSON in Excel VBA(11个回答)
8天前关闭
我的代码来检索STRINGA:
Private Sub RestExample()
Dim APICall As String
Dim Query As String
Dim strKey As String, STRINGA AS STRING
Dim myXML As New MSXML2.DOMDocument60
Dim nodes As IXMLDOMSelection
APICall = "https://oauth.openapi.it/counters/total"
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", APICall, False
.setRequestHeader "Authorization", "Basic " & PASSWORD
.send
STRINGA = .responseText
End With
End Sub
最后我在STRINGA:
{"data":{"GET:oauth.openapi.it\/counters":{"counter":22,"paid":0,"limit":false},"GET:oauth.openapi.it\/scopes":{"counter":6,"paid":0,"limit":false},"POST:oauth.openapi.it\/token":{"counter":1,"paid":0,"limit":false},"GET:imprese.openapi.it\/advance":{"counter":14,"paid":0,"limit":false},"GET:imprese.openapi.it\/base":{"counter":2,"paid":0,"limit":false}},"success":true,"message":"","error":null}
如何从Json节点获取所有值?
1条答案
按热度按时间tyky79it1#
下载VB-JSON: A Visual Basic 6 (VB6) JSON Parser Class Library并将必要的项添加到项目中。添加后,您可以像这样解析JSON字符串:
你可以像这样检索值
或者,如果你想迭代这些项,可以这样做: