[{bulkNo=91200256, cardType=CDMA_PP, denomination=300, endSerial=6048233, epfId=2254, nextSerialValue=6048226, startSerial=6048225}, {bulkNo=12050021, cardType=CDMA_PP, denomination=200, endSerial=6057151, epfId=2254, nextSerialValue=6057131, startSerial=6057131}, {bulkNo=12100005, cardType=CDMA_PP, denomination=100, endSerial=6003841, epfId=2254, nextSerialValue=6003842, startSerial=6003841}]
above shows my Gson array when i debug.need to iterate it and create objects from that
here shows my code
Gson gson = new Gson();
List<SerialDetails> serialDetails =new ArrayList<SerialDetails>();
serialDetails = gson.fromJson(sendJsonDataList, ArrayList.class);
for(int i = 0 ; i < serialDetails.size() ; i++){
SerialDetails item = (SerialDetails) serialDetails.get(i);//ERROR COMES IN HERE
System.out.println(item);
}
and here shows my error
java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to mainService.SerialDetails
at mainService.Sales.sendJsonDataList(Sales.java:677)
at mainService.TSR_WEB_SERVICE.sendJsonDataList(TSR_WEB_SERVICE.java:277)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
Please help me to sort-out this issue.my bean class correctly created with getters and setters