title: Android Volley - can't do a JSON request with POST, getting empty response
body: <p>I am trying to make a json request using Volley library to a php server, but for some reason the server does not receive the json object I am sending, and it responds with empty string.
  Here is my code</p>
  
  <pre><code>import android.content.Context;
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response.Listener;
  import com.android.volley.Response.ErrorListener;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.JsonObjectRequest;
  import com.android.volley.toolbox.Volley;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  public class MyVolley implements  Listener, ErrorListener {
  
      private static Context appContext;
  
      public MyVolley(Context context) {
          appContext = context;
      }
  
      public void stuff() throws JSONException {
          RequestQueue queue = Volley.newRequestQueue(appContext);
          JSONObject obj = new JSONObject();
          obj.put("param1", "assda");
          obj.put("param2", "fassfafsa");
          JsonObjectRequest stringRequest = new JsonObjectRequest(Request.Method.POST, "some url here", obj, this, this);
          queue.add(stringRequest);
      }
  
      @Override
      public void onResponse(Object response) {
          System.out.println(response);
      }
  
      @Override
      public void onErrorResponse(VolleyError error) {
          System.out.println(error);
      }
  }
  </code></pre>
  
  <p>And when it executes, this is what the server receives</p>
  
  <pre><code>array (
    'Content-Type' =&gt; 'application/json; charset=utf-8',
    'User-Agent' =&gt; 'pointless info here',
    'Host' =&gt; 'some host here',
    'Connection' =&gt; 'Keep-Alive',
    'Accept-Encoding' =&gt; 'gzip',
    'Content-Length' =&gt; '107',
  ) array (
  ) array (
  )
  </code></pre>
  
  <p>Why could that be happening?</p>