Try accumulate
in place of put
:
json.accumulate("section", "API");
json.accumulate("username", username);
json.accumulate("password", password);
Try this methode to set the header:
post.setEntity(se);
post.setHeader("Accept", "application/json");
post.setHeader("Content-type", "application/json");
Take also a look to Gson API if you want also. It helps to parse ... this IS a nice tuto .