I want to send the following JSON text
{\"Email\":\"aaa@tbbb.com\",\"Password\":\"123456\"}
to a web service and read the response. I kno
Nothing could be simple than this. Use OkHttpLibrary
Create your json
JSONObject requestObject = new JSONObject();
requestObject.put("Email", email);
requestObject.put("Password", password);
and send it like this.
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.addHeader("Content-Type","application/json")
.url(url)
.post(requestObject.toString())
.build();
okhttp3.Response response = client.newCall(request).execute();