i tried to post jsonobject in retrofit

2019-06-01 17:53发布

问题:

hi i tried to post the json data to server using retrofit interface

  @POST("something")
    Call<Test_Responce> testRes (@Body JSONObject paramObject);

function

try {
            JSONObject paramObject = new JSONObject();
            paramObject.put("test_id", 5);
            paramObject.put("user_id", "null");
            paramObject.put("org_id", 2);
            paramObject.put("schedule_id", 15);
            paramObject.put("group_id", "null");

            JSONObject current_section = new JSONObject();

            paramObject.put("current_section",current_section);


            Call<Test_Responce> userCall = api_interface.testRes(paramObject);
            userCall.enqueue(new Callback<Test_Responce>() {
                @Override
                public void onResponse(Call<Test_Responce> call, Response<Test_Responce> response) {
                    if (response.isSuccessful()){
                        Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT).show();
                    }else {
                        Toast.makeText(getApplicationContext(),"else",Toast.LENGTH_SHORT).show();

                    }
                }

it execute else part... i don't know where is error occur