title: Sending JSON Post with Body using Android Volley
body: <p>I am trying to send a JSON Post request using Android Volley library but I dont seem to get the body of the json right and I get undefined body parameters on my web server. I need the json's parameters body to be a single object "name=someVal&amp;comment=someOtherVal". name and comment are the keys and someVal and someOtherVal are the values.  </p>
  
  <pre><code>String spreadsheetID = "1111111-11111N92RT9h-11111111111111111111111111111";
  String url = "https://script.google.com/macros/s/" + spreadsheetID + "/exec";
  // Instantiate the RequestQueue.
  RequestQueue queue = Volley.newRequestQueue(this);
  
  // Request a string response from the provided URL.
  JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,
          url, null,
          new Response.Listener&lt;JSONObject&gt;() {
  
  @Override
  public void onResponse(JSONObject response) {
      Log.d("JSONPost", response.toString());
      //pDialog.hide();
  }
          }, new Response.ErrorListener() {
  
      @Override
      public void onErrorResponse(VolleyError error) {
          VolleyLog.d("JSONPost", "Error: " + error.getMessage());
          //pDialog.hide();
      }
  }) {
  
      @Override
      protected Map&lt;String, String&gt; getParams() {
          Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
          params.put("name=someVal&amp;comment=someOtherVal");
          //params.put("comment", "someOtherVal");
          return params;
      }
  };
  // Add the request to the RequestQueue.
  queue.add(jsonObjReq);
  </code></pre>
  
  <p>}</p>
  
  <p>I also tried this in the above code but no luck:</p>
  
  <pre><code>params.put("comment", "someOtherVal");
  params.put("name", "someVal");
  </code></pre>