I have a json api that I would like to fetch data from, however I can't figure out how to convert the json data into something useful.
The json response I have is:
From jsonplaceholder.
I would like to get the results in a Table.
Any suggestions?
VBA Code:
Sub getJSON()
Dim xmlhttp As New MSXML2.XMLHTTP60, myurl As String
myurl = "http://localhost:5000/api/v1/battery?limit=1"
xmlhttp.Open "GET", myurl, False
xmlhttp.send
Debug.Print (xmlhttp.responseText)
With Sheets("JSON")
.Cells(1, 1).Value = xmlhttp.responseText
.Cells(2, 1).Value = Split(xmlhttp.responseText)
End With
End Sub
The json response I have is:
VBA Code:
{"success":true,"count":1,"pagination":{"next":{"page":2,"limit":1}},"data":[{"_id":"5ec3d0c12cf31b3dfc48d540","data":{"alarmType":"Low Battery","devideId":"TEST123","reset":false},"created":"2020-05-19T12:27:45.999Z","__v":0}]}
From jsonplaceholder.
VBA Code:
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
I would like to get the results in a Table.
Any suggestions?