40
我想在我正在處理的Android應用程序的Java中發佈一些JSON數據。以下是否有效?是否需要以其他方式推送JSON字符串?如何將JSON添加到java中的一個http文章的正文
HttpPost httpost = new HttpPost("http://test.localhost");
httpost.setEntity(new StringEntity("{\"filters\":true}"));
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
//... other java code to execute the apache httpclient
預先感謝您