How to use retrofit without model class?

Published on Author Code Father

Yes, you can.


 Call<JsonObject> register(@Query("name") String name,

                           @Query("password") String password);

Just write JsonArray or JsonObject according to your response instead of Model class.

Then, get data from JsonObject or JsonArray which you get in response as below

Call<JsonObject> call = application.getServiceLink().register();

call.enqueue(new Callback<JsonObject>() {
            public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
                JsonObject object = response.body();
                //parse object 

            public void onFailure(Call<JsonObject> call, Throwable t) {