Android Question List key sequence

Discussion in 'Android Questions' started by nibbo, Sep 11, 2018.

Tags:
  1. nibbo

    nibbo Active Member Licensed User

    Hi All

    I use a webservice to return JSON data which looks something like:
    Code:
    Data:[{"col1":"value1","col2":"value2","col3":"value3","col4","value4"}{…etc...}]
    I store save the above to the list:
    Code:
    dim recordList = root.Get("Data")
    I then iterate through the list using:
    Code:
    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: Sep 11, 2018
  2. mangojack

    mangojack Well-Known Member Licensed User

    nibbo and JordiCP like this.
  3. nibbo

    nibbo Active Member Licensed User

    Thanks mj.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice