2

私は多くのソースを検索しましたが、これに対する答えを見つけることができませんでした..

JSONObject キーが逆の順序で返されることは周知の事実です。

JSONに表示される正しい順序でJSONObjectを再帰する方法はありますか

String json;
JSONObject obj = new JSONObject(json)
Iterator<String> keys = json.keys()   ---> order is reversed

JSONObject が順序付けられていないことは理解しています。おそらく順序付けする方法があるのでしょうか????

JSON は以下のタイプで、キーは一番下の styleHint タグから再帰され始めます

"sections": {


 "1": {
    "1": {
      "1": {
        "title": "xxx",
        "text": "xxx",
        "tags": {
          "audience": {
            "1": {
              "name": "xxx",
              "title": "xxx",
              "id": "xxx"
            }
          },
          "styleHint": {
            "1": {
              "name": "xxx",
              "title": "xxx",
              "id": "xxx"
            }
          }
        }
      },
      "title": "xxx",
      "text": "xxx",
      "tags": {
        "audience": {
          "1": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        },
        "styleHint": {
          "1": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        }
      }
    },
    "2": {
      "title": "xxx",
      "text": "xxx",
      "tags": {
        "audience": {
          "1": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        },
        "styleHint": {
          "1": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        }
      }
    },
    "title": "xxx",
    "text": "xxx",
    "tags": {
      "audience": {
        "1": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxx"
        },
        "2": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxx"
        }
      },
      "styleHint": {
        "1": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxx"
        }
      }
    }
  },
  "2": {
    "title": "xxx",
    "text": "xxx",
    "tags": {
      "audience": {
        "1": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxx"
        }
      },
      "styleHint": {
        "1": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxx"
        }
      }
    },
    "anchor":"xxx"

  },
  "3": {
    "1": {
      "title": "xxx",
      "text": "xxx",
      "tags": {
        "audience": {
          "tag": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        },
        "styleHint": {
          "tag": {
            "name": "xxx",
            "title": "xxx",
            "id": "xxx"
          }
        }
      }
    },
    "title": "xxx",
    "text": "xxx",
    "tags": {
      "audience": {
        "1": {
          "name": "xxx",
          "title": "xxx",
          "id": "xxxx"
        }
      },
      "styleHint": {
        "1": {
          "name": "xx",
          "title": "xxx",
          "id": "xxxx"
        }
      }
    }
  }  
}
4

1 に答える 1