When JsonObject's keys are iterated they aren't in the same order as in the response from the server

前端 未结 3 604
滥情空心
滥情空心 2020-12-03 04:56

I have a very large response from server of JSON string. I converted it to JSON object and then get the keys and iterate it.

The problem is that when I iterate it is

3条回答
  •  不知归路
    2020-12-03 05:39

    I came across this similar problem while working on section in my android app which displays a list of 1024+ websites alphabetically. Since the json traversal was not in sorted order , I just inserted the json values during traversal into a table ( I m using list adapters in my app) and obtained sorted list of websites with cursor.

    So if you are saving what you are fetching from server, you can just query your database to sort the values in the order your want.

提交回复
热议问题