Greetings All,
I have a JSON string downloaded from a website API. The string contains JSON items with what amounts to dictionaries and arrays of dictionaries. The usual JSON stuff.
I want to dig through the JSON, so I make an auto according to the methods shown in the Language reference.
dim xjd() as auto
xjd = Xojo.Data.ParseJSON(tx)
Then I loop through xjd according to LR method. This works, because xjd is recognised as an array of dictionaries.
[code]For each dJ as xojo.Core.Dictionary in xjd
dataLevelOne = dj.value("data")
info2 = Xojo.Introspection.GetType(dataLevelOne)
dLTwoText = Xojo.Data.GenerateJSON(dataLevelOne.value("data"))
dataLevelTwo = Xojo.Data.ParseJSON(dLTwoText)
info = Xojo.Introspection.GetType(dataLevelTwo)
next[/code]
But now I have a difficulty. dataLevelTwo is considered by Introspection as an array of Autos (it is in fact an array of dictionaries, according to the debugger).
So this code will refuse to compile, failing with a TypeMismatch.
for each item as xojo.core.dictionary in dataLevelTwo
info2 = Xojo.Introspection.GetType(item)
next
This code also fails to compile, considering that dataLevelTwo is not an array but I am treating it as one.
[code]for each item as auto in dataLevelTwo
info2 = Xojo.Introspection.GetType(item)
next[/code]
How do I access the dictionaries within dataLevelTwo ?