-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

4
  • 2
    What have you tried? You should edit your question and add some code of where your have aproblem so we can better understand how to help. Commented Feb 12, 2019 at 12:08
  • please remove the negative vote i update the queation with code okk Commented Feb 12, 2019 at 12:15
  • Charanveer, the downvote wasn't mine. Unfortunately people do that a lot without leaving comments, but don't worry about that. Commented Feb 12, 2019 at 12:16
  • 2
    possible reason of downvote is because you didn't spend enough time searching for the solution yourself. Commented Feb 12, 2019 at 12:44

1 Answer 1

-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);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.