Here you can find the source of postJSON(JSONObject job, HttpURLConnection conn)
public static void postJSON(JSONObject job, HttpURLConnection conn) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import org.json.JSONObject; public class Main { public static void postJSON(JSONObject job, HttpURLConnection conn) throws IOException { conn.setRequestMethod("POST"); // write it out yo OutputStream os = conn.getOutputStream(); os.write(job.toString().getBytes("UTF-8")); os.close();/*from w w w. j a v a 2 s . co m*/ } }