You can use JSON API to create a json array and then use URL Builder to send the json as a parameter to the API.
jsonAttriArray = new JSONArray();
try {
if (!someInput.getText().toString().equalsIgnoreCase(""))
{
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("object1", someInput.getText());
jsonAttriArray.put(jsonObject1);
}
if (!someInput2.getText().toString().equalsIgnoreCase(""))
{
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("object2", someInput2.getText());
jsonAttriArray.put(jsonObject2);
}
} catch (Exception e) {
// TO DO
}
Uri.Builder builder = new Uri.Builder();
builder.appendQueryParameter("jsonparams", jsonAttriArray.toString());
String query = builder.build().getEncodedQuery();
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write(query);
writer.flush();
writer.close();
os.close();