title: HttpURLConnection sending json object as base64. Why?
body: <p>I have this code:</p>
  
  <pre><code>URL url = new URL("http://httpbin.org/post");
  HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  
  conn.setRequestMethod("POST");
  conn.setRequestProperty("Content-Type", "application/json");
  conn.setRequestProperty("Accept", "application/json");
  conn.setDoOutput(true);
  conn.setDoInput(true);
  String jSonString = JSONUtils.toJSONString(request);
  byte[] outputInBytes = jSonString.getBytes();
  OutputStream os = conn.getOutputStream();
  os.write(outputInBytes);
  os.close();
  </code></pre>
  
  <p>What I want with it is to send the <code>request</code> object as a JSON. The problem is: the JSON is being sending encoded in Base64 without me want it to. I print the <code>jSonString</code> and it's the correct JSON, but when I print the mirrored response from httbin I notice that the JSON was sent Base64 encoded. If I decode it, it's the correct JSON object string, but I don't want it to be sent encoded. Does anyone knows why this is happening?</p>