我想通过使用volley库{"user_id":12,"answers":{"11":3,"12":4,"13":5}}将以下格式的jsonobject发送到服务器
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();
}
Run Code Online (Sandbox Code Playgroud)
如果我想使用StringRequest,我应该如何使用POST方法将此JsonObject发送到服务器