我有一個JSONObject,我通過API獲取。 它是這樣的:JAVA按JSONObject(String,Int)降序排序
{
"wash_method": 305,
"fragrance": 1156,
"sweater_type": 260,
"dial_color": 66475,
"charger_type": 2581,
"pen_drives_interface": 563,
"watches_type": 66475,
"processor": 3270,
"frame_material": 1211,
"dial_shape": 66475,
"os": 3308
}
我想排序這個值的基礎上,得到這樣一個結果:
{
"dial_shape": 66475,
"dial_color": 66475,
"watches_type": 66475,
"os": 3308,
"processor": 3270,
"charger_type": 2581,
"frame_material": 1211,
"fragrance": 1156,
"pen_drives_interface": 563,
"wash_method": 305,
"sweater_type": 260,
}
正如你所看到的前3項有類似的值,這樣就可以以任何方式安排。
我該怎麼做? (有沒有辦法以最小的複雜性做呢?)
JSON對象有,也不是「排序」 – Blackbelt
它必須通過API開發人員給予ü響應 – vishnus
@vishnus它是一個第三方API之前完成的概念。我需要在我身邊做。 –