Вы можете использовать HttpClient и HttpPost для отправки строки json в качестве тела:
public void post(String completeUrl, String body) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(completeUrl);
httpPost.setHeader("Content-type", "application/json");
try {
StringEntity stringEntity = new StringEntity(body);
httpPost.getRequestLine();
httpPost.setEntity(stringEntity);
httpClient.execute(httpPost);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Пример тела Json:
{
"param1": "value 1",
"param2": 123,
"testStudentArray": [
{
"name": "Test Name 1",
"gpa": 3.5
},
{
"name": "Test Name 2",
"gpa": 3.8
}
]
}