Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"result": [
- {"name":"??? ?????",
- "type":2,
- "latlong":"26.547745,82.431729"},
- {"name":"????",
- "type":2,
- "latlong":"20.169723,85.415944"},
- {"name":"??????",
- "type":2,
- "latlong":"20.674808,76.882579"},
- {"name":"???????",
- "type":2,
- "latlong":"20.664026,76.542137"}
- ]}
- Set json = JsonConverter.ParseJson(strJSON)("result")
- For Each i In json
- Set dict = i
- 'Other code
- Next i
- Select Case key2
- Case "name"
- .Cells(counter, 1) = dict(key2)
- Case "type"
- .Cells(counter, 2) = dict(key2)
- Case "latlong"
- .Cells(counter, 3) = dict(key2)
- End Select
- Option Explicit
- Public Sub GetInfo()
- Dim strURL As String, strJSON As String
- Dim http As Object
- Dim json As Object, item As Long
- Application.ScreenUpdating = False
- strURL = "http://www.vehicletrack.biz/api/xlsmaster?usr=rahul&pwd=togodeamo&type=2"
- Set http = CreateObject("MSXML2.XMLHTTP")
- http.Open "GET", strURL, False
- http.send
- strJSON = http.responseText
- Set json = JsonConverter.ParseJson(strJSON)("result") 'dictionary one key of "Result" which is a collection of dictionaries when accessed
- Dim i As Object, dict As Object, key2 As Variant, counter As Long
- counter = 4
- For Each i In json
- Set dict = i
- For Each key2 In dict.Keys
- With ActiveSheet
- Select Case key2
- Case "name"
- .Cells(counter, 1) = dict(key2)
- Case "type"
- .Cells(counter, 2) = dict(key2)
- Case "latlong"
- .Cells(counter, 3) = dict(key2)
- End Select
- End With
- Next key2
- counter = counter + 1
- Next i
- Application.ScreenUpdating = True
- End Sub
Add Comment
Please, Sign In to add comment