I want to get string json from my api using retrofit 2, I have no problem when using retrofit 1 to get this json but using retrofit 2 returns null for me.
This is what my json looks like
{"id":1,"Username":"admin","Level":"Administrator"}
This is my API
@FormUrlEncoded
@POST("/api/level")
Call<ResponseBody> checkLevel(@Field("id") int id);
This is how my code looks like
Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Config.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        Api api = retrofit.create(Api.class);
        Call<ResponseBody> call = api.checkLevel(1);
        call.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                JsonObject post = new JsonObject().get(response.body().toString()).getAsJsonObject();
                    if (post.get("Level").getAsString().contains("Administrator")) {
                    }
            }
            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
            }
        });
I'm new to retrofit 2 and using above code, it always make my apps crash because response.body().toString() returns null.
Please guide me on how to get that json string so I can convert it into JsonObject.
 
     
    
 
    
 
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    