关于这样的JSON文件,怎么解析呢?
http://www.taobao.com/go/rgn/citydata.php
用VB怎么解析这种文件呢?
[解决办法]
Private Sub CommandButton1_Click()
On Error Resume Next
Dim arr()
bt = Split("id,name,order,num,updateTime,message,errCode,status,data", ",")
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", "http://www.taobao.com/go/rgn/citydata.php", False
.send
tt = Replace(Replace(.responsetext, "(", "brr="), ");", ";")
With CreateObject("MSScriptControl.ScriptControl")
.Language = "JScript"
.AddCode tt
For i = 0 To 34
Cells(i + 1, 1) = .Eval("brr.nodes[" & i & "].id")
Cells(i + 1, 2) = .Eval("brr.nodes[" & i & "].value")
Cells(i + 1, 3) = .Eval("brr.nodes[" & i & "].children[0].children[0].id")
Cells(i + 1, 4) = .Eval("brr.nodes[" & i & "].children[0].children[0].value")
Next i
End With
End With
End Sub