-1

How to Parse Array response using Gson in android. and how to pass model class in retrofit request.Please Give me Answer of this question i m facing this problem using array response.

private void getitemlist() {
        apiInterface.getVendorItems("_apiagent_/_data_agentPSS.php?k=825k9mksd35terijfh36374fhfgr7362hdfhf74&v=2&w=N_vendor_idEQUALTO"+getIntent().getStringExtra("userid")).enqueue(new Callback<GetItems>() {
            @Override
            public void onResponse(Call<GetItems> call, Response<GetItems> response) {

            }
            @Override
            public void onFailure(Call<GetItems> call, Throwable t) {

            }
        });
    }

please check the link of this api response

http://fssai.cmis.co.in/apiagent/_data_agentPSS.php?k=825k9mksd35terijfh36374fhfgr7362hdfhf74&v=3 Response setrt with Json Array

1 Answers1

-3

i am sure you are looking for this

Gson gson = new Gson();
Type listType = new TypeToken<List<HubLoginApus>>(){}.getType();
List<HubLoginApus> posts = gson.fromJson(response.body(), listType);
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92