title: Jsoup HTTP POST with payload
body: <p>I am trying to make this HTTP request via jsoup as given <a href="http://developer.decarta.com/Docs/REST/BatchRequests" rel="nofollow noreferrer">here</a>:</p>
  <pre><code>http://api.decarta.com/v1/[KEY]/batch?requestType=geocode
  </code></pre>
  <p>And here is my code for that:</p>
  <pre class="lang-java prettyprint-override"><code>String postUrl = postURLPrefix + apiKey + &quot;/batch?requestType=geocode&quot;;
  String response = Jsoup.connect(postUrl).timeout(60000).ignoreContentType(true)
          .header(&quot;Content-Type&quot;, &quot;application/json;charset=UTF-8&quot;)
          .method(Connection.Method.POST)
          .data(&quot;payload&quot;, jsonPayload.toString())
          .execute()
          .body();
  </code></pre>
  <p><code>jsonPayload.toString()</code> gives this:</p>
  <pre><code>{
    &quot;payload&quot;: [
      &quot;146 Adkins Street,Pretoria,Pretoria,Gauteng&quot;,
      &quot;484 Hilda Street,Pretoria,Pretoria,Gauteng&quot;,
      &quot;268 Von Willich Street,Centurion,Centurion,Gauteng&quot;,
      ...
    ]
  }
  </code></pre>
  <p>Which is a perfectly valid JSON.</p>
  <p>However, jsoup each time returns HTTP status code <em>400</em> (malformed).<br />
  So, how do I send proper HTTP <em>POST</em> with JSON payload using jsoup if this is possible at all? (Please note that it's <strong>payload</strong> and not an ordinary key-value pair in URL)</p>