title: Google Volley POST request in android studio with JSON body?
body: <p>This is my piece of code that I am using to make a POST request.</p>
  <pre><code>RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
  
              String url = &quot;myUrl.....&quot;;
              StringRequest stringRequest = new StringRequest(Request.Method.POST, url, response -&gt; {
                  Toast.makeText(MainActivity.this, &quot;Response: &quot;+response, Toast.LENGTH_SHORT).show();
                  try {
                      JSONObject mainObject = new JSONObject(response);
                      error = mainObject.getBoolean(&quot;error&quot;);
                      //Toast.makeText(getApplicationContext(), error, Toast.LENGTH_SHORT).show();
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
  
                  if(!error){
                      SharedPreferences.Editor editor = sharedPreferences.edit();
                      editor.putString(userNameShared, email);
                      editor.putString(passwordShared, password);
                      editor.commit();
                      startActivity(new Intent(MainActivity.this, MainActivityDashboard.class));
                  }
                  else{
                      editTextEmail.setError(&quot;Invalid e-mail&quot;);
                      editTextPassword.setError(&quot;Invalid password&quot;);
                      return;
                  }
  
              }, error -&gt; Toast.makeText(MainActivity.this, &quot;Error: &quot;+error.getMessage(), Toast.LENGTH_SHORT).show()){
                  @Override
                  protected Map&lt;String, String&gt; getParams() throws AuthFailureError
                  {
                      Map&lt;String,String&gt; params = new HashMap&lt;String, String&gt;();
                      params.put(&quot;email&quot;, email);
                      params.put(&quot;password&quot;, password);
                      params.put(&quot;rememberPassword&quot;, false);
                      params.put(&quot;ip_address&quot;, ipAddress);
                      params.put(&quot;isCaptchaEnabled&quot;, false);
                      return params;
                  }
  
                  @Override
                  public Map&lt;String,String&gt; getHeaders() throws AuthFailureError {
                      Map&lt;String,String&gt; params = new HashMap&lt;String, String&gt;();
                      params.put(&quot;Context-Type&quot;,&quot;application/json&quot;);
                      return params;
                  }
              };
  
              requestQueue.add(stringRequest);
          });
  </code></pre>
  <p>Everything worked perfectly in previous projects but here the problem is now that I want to include boolean values along with String values in the POST body.</p>
  <p>The body is as follows:
  {
  &quot;email&quot;:&quot;username@mail.com&quot;,
  &quot;password&quot;:&quot;somepassword&quot;,
  &quot;rememberPassword&quot;: false,
  &quot;ip_address&quot;: &quot;152.57.31.41&quot;,
  &quot;isCaptchaEnabled&quot;: false
  }</p>
  <p>I am new to API calls and JSON.
  I tried searching for answers on google but everyone is just using Map&lt;String, String&gt; in getParams wherein in my case I am not sure what must I use.
  I tried to include the body into JSONObject and tried returning it but it's giving me typecast error. Or is there any other method beside getParams in volley that allows to pass different datatypes in value.
  Please help me how can I reconfigure my code and make it work.</p>