I’m using @Kem_Tekinay’s terrific M_JSON classes to parse some incoming JSON that includes a dictionary and several arrays of objects, all of which are dictionaries. Maybe it’s just one of those days where I can’t see the forest for the trees, but I can’t figure out how to retrieve the dictionaries that are within the arrays.
Here’s the relevant code:
Dim v as Variant v=ParseJSON_MTC(content, False, True) 'Content incoming from the URLConnection 'Returns a dictionary with four entries: 'The first is a dictionary 'The second and third are arrays of 4 objects (ubound=3), all of which are dictionaries 'The fourth is a dictionary If v IsA Dictionary Then For Each ky As DictionaryEntry In Dictionary(v) If ky.Key="latest-build" Then 'A single dictionary, easy Elseif ky.key="messages" Then If ky.Value.IsArray Then 'This is an array of objects, all of which are Dictionaries Dim dvalues As Variant For j=0 To UBound(Array(ky.Value)) dVal=Dictionary(Array(ky.Value(j))) 'Not an array, but treating it as one" <<<<==== THE PROBLEM LINE If dVal IsA Dictionary Then For Each de As DictionaryEntry In Dictionary(dVal) KeyStr=de.Key Astr=de.Value Next End If Next End If etc...
It must be something simple and obvious, thoughts?
Thank you -