JSONObject cannot be converted to JSONArray

前端 未结 1 1987
鱼传尺愫
鱼传尺愫 2021-01-15 18:21

My Android application is expecting and array of usernames from my WCF Service using the following Java, to then populate a spinner.

JSONArray mtUsers = new          


        
相关标签:
1条回答
  • 2021-01-15 18:55

    actually you are getting jsonObject, the value of the first key "GetUserNamesResult" is JSONArray.

    so do this..

    JSONObject jsonResponse = new JSONObject(new String(buffer));
    JSONArray mtUsers = jsonResponse.getJSONArray("GetUserNamesResult");
    
    0 讨论(0)
提交回复
热议问题