URLConnection conn = url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "text/plain");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
conn.getOutputStream());
JSONObject jsonObject = new JSONObject();
jsonObject.put("getinfo", "");
jsonObject.writeJSONString(outputStreamWriter);
outputStreamWriter.flush();
outputStreamWriter.close();
DataInputStream input = new DataInputStream(conn.getInputStream());
Edit: The JSONObject was wrong, this one works:
jsonObject.put("method", "getinfo");
jsonObject.put("params", null);