40
Sto provando a pubblicare alcuni dati JSON in java per un'applicazione Android su cui sto lavorando. È il sotto valido o devo spingere la stringa JSON in un modo diverso?Come aggiungere json al corpo di un post http in java
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
Grazie in anticipo