Volley envía JSONObject al servidor con el método POST
Quiero enviar un objeto jsonobject con el siguiente formato al servidor usando la biblioteca volley{"user_id": 12, "answers": {"11": 3, "12": 4, "13": 5}}
JSONObject object = new JSONObject();
try {
object.put("user_id", user_id);
JSONObject answers = new JSONObject();
for (int i = 0; i < questions.size(); i++) {
JSONObject answer = new JSONObject();
answer.put(questions.get(i).getId(),questions.get(i).getAnswer());
answers.put("answers", answer);
object.put("answers", answer);
}
} catch (JSONException e) {
e.printStackTrace();
}
Si quiero usarStringRequest ¿Cómo debo enviar este JsonObject al servidor utilizando el método POST?