0

Hello, I am trying to parse a json response . This is the response from the server :

enter image description here

This is the my android code:

String ORDER_DETAILS = "http://testproject1.indigierp.com/api/orderdetails?";
String Token = "267sdfZkahs&adaj";
String getOrderID = "13492";
     RequestQueue queue = Volley.newRequestQueue(OrderDetailsCard.this);

        JsonArrayRequest jsonArrayRequest = new JsonArrayRequest
                (Request.Method.POST, ORDER_DETAILS + "token=" + Token + "&order_id=" + String.valueOf(getOrderID),
                null, new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response) {
                        Log.e("Response", String.valueOf(response));

                        for (int i = 0; i < response.length(); i++) {

                            Log.e("Respo", String.valueOf(response));
                            try {
                      
                                JSONObject jsonObject = response.getJSONObject(i);
                                JSONArray jsonArray = jsonObject.getJSONArray("data");
                                for (int j = 0; j < jsonArray.length(); j++) {
                                    JSONObject jsonObject1 = jsonArray.getJSONObject(j);
                                    String product = jsonObject1.getString("product");
                                    Log.e("PRODUCT", product);

                                }

                            } catch (JSONException e) {
                                e.printStackTrace();

                                        .show();

                            }
                            dialog.dismiss();
                        }

                    }
                }, error -> {

            Log.e("Error", error.getLocalizedMessage());
            dialog.dismiss();

        });

        queue.add(jsonArrayRequest);

But, everytime the error i get on logcat is this :

Error: org.json.JSONException: End of input at character 0 of

I am getting the response properly in the postman app, but What am I doing wrong in the App, please guide.

Sainita
  • 282
  • 1
  • 11

0 Answers0