Android Question List key sequence

nibbo

Active Member
Licensed User
Longtime User
Hi All

I use a webservice to return JSON data which looks something like:
B4X:
Data:[{"col1":"value1","col2":"value2","col3":"value3","col4","value4"}{…etc...}]

I store save the above to the list:
B4X:
dim recordList = root.Get("Data")

I then iterate through the list using:
B4X:
For i = 0 To recordList.Size - 1
    Dim m As Map = recordList.Get(i)
    For Each k As String In m.Keys
        Log(k)
    Next
Next

But the order of the keys does not match the order in the JSON, in the example I am running it returns col1, col4, col2 , col3. Is that just how it works or should it retain the correct sequence?
I am sure it was in the correct order when I first wrote and tested the code!

Thanks
 
Last edited:

mangojack

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top