title: Why JSON Response is 200
body: <p>a) Actually I have 1 endpoint which will post to a server using volley. Also my api also have custom header &amp; custom body.The problem is when I want to get the response of JSON it will not display it. Instead it will display 200.For this I am not using form but I just get the body data from shared preference.</p>
  
  <p>b) I have other endpoint using custom header &amp; body but using form which will submit the data to the server. The JSON response is ok and it will display it.</p>
  
  <p>a) JSON response will display  200  </p>
  
  <p>//code for a the different is </p>
  
  <p>jsonBody.put("tbid", id);</p>
  
  <p>the id is not getting from edittext like b.Instead is getting from shared preference and I confirm that the id is legit and getting the data.</p>
  
  <p>b) JSON response will display</p>
  
  <pre><code>{ success:"1",message:"register" }
  </code></pre>
  
  <p>//this is the code  for b  </p>
  
  <pre><code>private void requestOTP(){
      pDialog = new ProgressDialog(this);
      pDialog.setCancelable(false);
      pDialog.setMessage("OTP OTW...");
      showDialog();
  
      try {
                      RequestQueue requestQueue = Volley.newRequestQueue(this);
          JSONObject jsonBody = new JSONObject();
          jsonBody.put("tbid", str5);
          jsonBody.put("phone",phone.getText().toString());
          final String mRequestBody = jsonBody.toString();
  
          StringRequest strReq = new StringRequest(Request.Method.POST, URL_OTP_REQUEST, new Response.Listener&lt;String&gt;() {
              @Override
              public void onResponse(String response) {
                  Log.e(TAG, "OTP Response: " + response);
  
                  hideDialog();
  
                  try {
                      JSONObject jObj = new JSONObject(response);
                      success = jObj.getInt(TAG_SUCCESS);
  
                      Log.e(Integer.toString(success),"SuccessRe");
  
  
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
  
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  Log.e(TAG, "OTP Error : " + error.getMessage());
                  Toast.makeText(getApplicationContext()," OTP Error ",
                          Toast.LENGTH_LONG).show();
                  hideDialog();
              }
          }){
  
                              @Override
              public String getBodyContentType() {
                  return "application/json; charset=utf-8";
              }
  
              @Override
              public byte[] getBody() throws AuthFailureError {
                  try {
                      return mRequestBody == null ? null : mRequestBody.getBytes("utf-8");
                  } catch (UnsupportedEncodingException uee) {
                      VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s", mRequestBody, "utf-8");
                      return null;
                  }
              }
  
  
  
              @Override
              protected Response&lt;String&gt; parseNetworkResponse(NetworkResponse response) {
                  String responseString = "";
                  if (response != null) {
                      responseString = String.valueOf(response.statusCode);
                  }
                  return Response.success(responseString, HttpHeaderParser.parseCacheHeaders(response));
              }
  
  
              /** Passing some request headers* */
              @Override
              public Map getHeaders() throws AuthFailureError {
                  HashMap headers = new HashMap();
                  headers.put("Auth-Key", "xxx");
                  headers.put("Token", token);
                  return headers;
              }
  
  
          };
  
  
  
          //Adding request to request queue
  
          requestQueue.add(strReq);
  
      }catch (JSONException e) {
          e.printStackTrace();
      }
  
  
  
  }
  </code></pre>
  
  <p>c) I also make a new project using the endpoint because I thought the problem maybe the json response is getting from other endpoint in the project.But nothing changed.</p>
  
  <p>d) Already use postman and the result is ok it will show like b the json response. </p>
  
  <p>e) My other  option to test whether it work is  using async task or using form to post the data body.</p>
  
  <p>Why I get different result for a &amp; b ??Is this problem with server side or with client side?Is this because I am not sending the data body using form??I know that 200 response mean that  connection is ok.But I just want to know why I dont get the JSON response like in a.</p>
  
  <p><strong>volley</strong></p>