GSON. How to convert json object to json array?

前端 未结 7 1881
没有蜡笔的小新
没有蜡笔的小新 2021-02-08 15:20

Now I am getting this JSON from API:

{\"supplyPrice\": {
        \"CAD\": 78,
        \"CHF\": 54600.78,
        \"USD\": 20735.52
      }}

But

7条回答
  •  难免孤独
    2021-02-08 16:00

    Once look at this.. may help you.

     JSONObject json= json.getJSONObject("supplyPrice");
        Iterator i = json.keys();
        JSONArray jsonArray = new JSONArray();
    
        while (i.hasNext()){
            String key = (String) i.next();
            jsonArray.put(json.get(key));
    

提交回复
热议问题