【发布时间】:2017-02-14 10:16:18
【问题描述】:
我目前正在尝试将 JsonObject 发布到我的 API 并从服务器获取 JsonArray 响应。我该怎么办?如果我尝试,我会收到异常错误
JsonObjectRequest postRequest = new JsonObjectRequest(Request.Method.POST, url_test,new JSONObject(params),
new Response.Listener<JSONObject>() {
@Override
【问题讨论】:
-
请您告诉哪个
Exception被抛出? -
发布崩溃日志和完整代码..
-
com.android.volley.ParseError: org.json.JSONException:
-
我知道出了什么问题。我得到一个 JSONArray 作为响应并像 JsonObject 一样解析它。我的问题是我将如何使用 volley 创建一个发布 JsonObject 并监听 JsonArray 的发布请求。
-
您只需要发出 json 数组请求,因为您期望数组返回。我相信你发布的数据无关紧要 -- androidhive.info/2014/05/android-working-with-volley-library-1 -- androidhive.info/2014/07/…
标签: android json post android-volley