Unable to return JSON Object, within Object in Android app

前端 未结 3 484
有刺的猬
有刺的猬 2020-12-22 11:12

So I have an Android app I am working on that makes an API call to the server and returns JSON information. Now in my android app I can parse the JSON but only up until the

3条回答
  •  抹茶落季
    2020-12-22 11:39

    You can create JSON array when create JSON object fail

    try {
        JSONObject jsonObject = new JSONObject(result);
        // do something
    }catch (JSONException e) {
        try{
        JSONObject jsonObject = new JSONArray(result);
        // do something
        }catch(JSONException e){
        //...
        }
    }
    

提交回复
热议问题