We can build the Above json format using JsonObject class which is available with javax.json-1.0.2.jar,
JsonObject jo = Json.createObjectBuilder()
.add("data", 2376845)
.add("data2", 12545)
.add("array",Json.createArrayBuilder()
.add(Json.createObjectBuilder().add("data3", "2013-01-10").add("data4", 23532).build())
.add(Json.createObjectBuilder().add("data3", "2013-01-11").add("data4", 523526).build()))
.build();
After building json format
AsyncHttpClient client=new AsyncHttpClient();
Request request = client.preparePost(your host URL).
setHeader("Content-Type","application/json").
setHeader("Content-Length", ""+jo.toString().length()).setHeader("Authorization","Basic fgfgfgfhfhtetet=").
setBody(jo.toString()).build();
ListenableFuture<Response> r = null;
//ListenableFuture<Integer> f= null;
try{
r = client.executeRequest(request);
System.out.println(r.get().getResponseBody());
}catch(IOException e){
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
if you required basic authentication you need to add a key which is combination of username:password encoded with base64 to header,if not leave it
in this case i added it to header
mostly this will work's for you
Note:AsyncHttpClient,ListenableFuture classes are available in async-http-client-1.7.5.jar