How to iterate over a JSONObject?

后端 未结 16 1865
孤街浪徒
孤街浪徒 2020-11-22 04:17

I use a JSON library called JSONObject (I don\'t mind switching if I need to).

I know how to iterate over JSONArrays, but when I parse JSO

16条回答
  •  [愿得一人]
    2020-11-22 04:51

    org.json.JSONObject now has a keySet() method which returns a Set and can easily be looped through with a for-each.

    for(String key : jsonObject.keySet())
    

提交回复
热议问题