Deciding POJO java class for JSON payload after inspecting JSON in list in Retrofit -


i have json payload coming server list of objects. need way response , check each object particular attribute , decide pojo object decode each of those. have checked stackoverflow , have come across solutions :

gson gson = new gson(); string json = response.getbody().tostring(); if (checkresponsemessage(json)) {     pojo1 pojo1 = gson.fromjson(json, pojo1.class); } else {    pojo2 pojo2 = gson.fromjson(json, pojo2.class); } 

here json string entire string list of objects, need drill down list, check attribute in object determine pojo use. pointers or appreciated! thanks!