The docs for the source vba-json state:
parse JSON and create Dictionary/Collection
So you will get back one of those objects. This seems to work:
Sub testJson()
Dim Json As Object
Set Json = JsonConverter.ParseJson("{""a"":123,""b"":[1,2,3,4],""c"":{""d"":456}}")
Debug.Print Json("a") ' -> 123
Debug.Print Json("b")(2) ' -> 2
Debug.Print Json("c")("d") ' -> 456
Json("c")("e") = 789
Dim var As Object
' Get the object from Json
Set var = Json("b")
' Both Dictionary and Collection support the Count property
Debug.Print var.Count
Dim elem As Variant
For Each elem In var
Debug.Print elem
Next elem
Debug.Print JsonConverter.ConvertToJson(Json)
' -> "{""a"":123,""b"":[1,2,3,4],""c"":{""d"":456,""e"":789}}"
End Sub
The "b" in the Json example returns a collection but for "c" you would get back a dictionary.
Json("b")give you? "[1,2,3,4]" or "1,2,3,4" or something else?Json("b")? Have you tried the usual VBA array size functions? So,LBound(JSon("b"))andUBound(JSon("b"))? Or tryJson("b").Countas the docs for vba-json imply it returns a dictionary/collection.Do While ... Looploop tillJson("b")(counter)returns no error?