I see the advantage of Auto
over Variant
but I do find it too verbose.
I’m converting some JSON to a Xojo.Core.Dictionary
with the Xojo.Data.ParseJSON
command. All is well. The result is stored in a Xojo.Core.Dictionary
called data
. The JSON contains an array of tags, so data.Value("tags")
becomes an Auto array holding the tags I want to get at.
All I’m trying to do is convert the Auto
array within the Xojo.Core.Dictionary
to a Text
array. The following seems to work but I’m hoping there is a faster or more elegant way (as looping seems inefficient):
If data.HasKey("tags") Then
Dim autoArray() As Auto = data.Value("tags")
Dim textArray() as Text
data.Remove("tags") ' don't want this anymore
For Each tag As Auto In autoArray
textArray.Append(CType(tag, Text))
Next tag
End If
Is there a better way? I’ve tried several but I keep getting TypeMismatch errors