vbs解析 JSON格式数据

Function jsonParser(str,jsonKey)
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "JScript"
sc.AddCode "var tmp = " & str & ";"
jsonParser = sc.Eval("tmp." & jsonKey)
End Function

Function getJSONData(URL) 
    Set objXML=CreateObject("Microsoft.XMLHTTP")
    objXML.Open "Get", Url, False
    objXML.send
    If objXML.readyState=4 then 
        getJSONData =objXML.ResponseText
    End If
    objXML.Abort 
    Set objXML = Nothing
End Function



Function timeMethord()
Dim intX,intY,ForIndex,requestUrl,requestBackData,JsonArrayLength
requestUrl = "https://www.222.com/yulebaoServlet/AAAAAQQAccountSheet?sgin=1"
requestBackData= getJSONData(requestUrl)
JsonArrayLength = jsonParser(requestBackData, "Rows.length")
For i = 0 To JsonArrayLength - 1
TracePrint jsonParser(requestBackData, "Rows[" & i & "].HangQQAndPasswordGroup")
Next 
End Function

原文地址:https://www.cnblogs.com/xiaoliao/p/9543785.html