Need help with dictionary in iOS

I’m not sure how to do what I need and have been stumbling through the documentation without figuring this out yet. I figure it will be quicker to ask for help and get pointed in the right direction.

I have some JSON that I parse into a xojo.Core.Dictionary. One of the values is an array that is either an array of text items or an array of dictionary items. I want to loop through the array to add the items to a Table, but I’m not sure how to tell if the value I have is a dictionary or a text value.

I have:

Dim ListDict As xojo.Core.Dictionary
Dim ListItems As Auto

ListDict = Xojo.Data.ParseJSON(ListJSON)

ListItems = ListDict.Value(“ListValue”)
for each ListEntry As Auto in ListItems

 (I want to test here and if ListEntry is a dictionary then I'll handle one way, otherwise I know that it is just a plain array of text items and I can just use the value.)


Any examples I can look at? I’ve been trying a number of different examples but haven’t found one yet that has what I need.


I just realized my example code above does not work. ListItems isn’t known as an array so it doesn’t work as shown, I did change in my code to create it as an array.

I have done the following which seems to work okay. But if there is a better way I’d appreciate any suggestions.

    info = Xojo.Introspection.GetType(ListEntry)
    if (info.IsPrimitive) then
      // will be a text if it is primitive
      // this will be a dictionary item
    end if