How do I send JSon as BODY In a POST request to server from an Android application?
问题 I am working on my first Android Application. What I am trying to do is a POST request to a REST service I want the BODY of this request to be a JSON String. I am using google's GSON to generate the JSON that is sent to the server. Here is the code doing POST request: HttpPost requisicao = new HttpPost(); requisicao.setURI(new URI(uri)); requisicao.setHeader("User-Agent", sUserAgent); requisicao.setHeader("Content-type", "application/json"); HttpResponse resposta = null; //I can see the json