I got some JSON parsing working. I use VBA to parse a JSON code from my webserver, write that to cell A1 at my Excel Worksheet. But I don't get this to convert into the other cells.
Here is my JSON sample:
{
"@type":["IN.areaList.1","OII.list.1"],
"@self":"/bereiche",
"list":[
{"@type":["IN.bereich.1"],
"@self":"/1.1.Bereich.2.7",
"scha":false,
"trlState":"",
"oiischa":false,
"readyTo1":false,
"readyTo2":false,
"numberOfBypassedDevices":0,
"test":"",
"TestActive":false,
"chModeActive":false,
"incs":[]}
]
}
This is my Sub, it is working for another sample:
Sub JsonToExcelExample()
Dim jsonText As String
Dim jsonObject As Object
Dim item As Object
Dim i As Long
Dim ws As Worksheet
Set ws = Worksheets("Remote")
jsonText = ws.Cells(1, 1)
Set jsonObject = JsonConverter.ParseJson(jsonText)
i = 3
ws.Cells(2, 1) = "Color"
ws.Cells(2, 2) = "Hex Code"
For Each item In jsonObject("0")
ws.Cells(i, 1) = item("color")
ws.Cells(i, 2) = item("value")
i = i + 1
Next
End Sub
How this VBA code should be changed so that the above JSON sample to be placed on the worksheet like a table?


JSON.ToArrayand output result arrays to worksheet, take a look at code examples. Show the expected output for the sample you have.