So I am using a JsonObjectRequest
to send up a JsonObject
to a rest call, but its returning a JsonArray
rather then a JsonObject
. Its giving me an error saying that it cannot parse the results from the JsonObjectRequest
, but if I use JsonArrayRequest
i cant send up a JsonObject
in the body. How do I send up a JsonObject
but get a JsonArray
as a response?
RequestQueue queue = Volley.newRequestQueue(this);
JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST,url,jsonBody,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
String test = "";
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
StringRequest
? try it and check what String value getting inonResponse
– ZipahStringRequest postRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
may help you – Interior