【问题标题】:How to sort a JSONArray of JSONObjects alphabetic based on a field in the JSONObject如何根据 JSONObject 中的字段对 JSONObjects 的 JSONArray 进行排序
【发布时间】:2012-04-16 09:58:36
【问题描述】:

我有一个 JSONObjects 的 JSONArray。

如何根据 JSONObject 中的字符串字段对 JSONArray 进行字母排序?

【问题讨论】:

    标签: android json sorting arrays alphabetical-sort


    【解决方案1】:

    不要以为你可以用 JSONArray 和 JSONObject 类做到这一点。您必须反序列化为其他 Java 类并使用这些函数进行排序。

    反序列化的最佳方法可能是使用 Google GSON 库:https://sites.google.com/site/gson/gson-user-guide#TOC-Collections-Examples

    【讨论】:

      猜你喜欢
      • 2012-10-05
      • 1970-01-01
      • 1970-01-01
      • 2018-05-19
      • 1970-01-01
      • 2015-10-27
      • 1970-01-01
      • 2017-09-06
      • 1970-01-01
      相关资源
      最近更新 更多