I've imported the VBA JSON library into my VBA project but I can't get it to create the JSON object properly. I've fallen at the first hurdle.
Even the example code that they give isn't working:
Sub test()
Dim Json As Object
Set Json = JsonConverter.ParseJson("{""a"":123,""b"":[1,2,3,4],""c"":{""d"":456}}")
' Json("a") -> 123
' Json("b")(2) -> 2
' Json("c")("d") -> 456
MsgBox Json("c")("e") = 789
End Sub
This gives the following answers:
a
2
456
null
I've selected the Microsoft Scripting Runtime library and added the VBA Dictionary class.
MsgBox Json("c")("e") = 789here you're passing the result of adding a new key and value to Json("c") to Msgbox: that operation doesn't return a value, so there's nothing to show. I can't explain that first "a" though