I am quite new to use the JSON third party API FlexJson. I am using this jar for deserialize the JSON to java Object(user defined). The class contains two array objects. When i use this jar to deserialize this json to my object an error is occuring. The Error is "flexjson.JSONException: Cannot instantiate abstract class or interface". I am getting the Response string from the server With REST web service is :
{"eobPaymentDetails": [
{"sFileName":"370530424.txt","sCheckNumber":"1QG74316091"},
{"sFileName":"370861045.txt","sCheckNumber":"161018160011247"},
{"sFileName":"370972783.txt","sCheckNumber":"461640055"},
{"sFileName":"370691977.txt","sCheckNumber":"461624870"}
],
"eraPostingDetails":[
{
"iClinicId":97452,
"sPatientAccountNumber":"2994234wer2",
"sDescription":"This corresponding payer is not match with the Patient's current payer",
"sEraName":"371434025.txt",
"sCheckDate":"2016-10-21",
"iPaymentId":370976,
"sPayerName":"Payer",
"iType":3,
"blSent":false,
"sEobNumber":null,
"iId":1,
"sCheckNumber":"046705983",
"sPatientName":"Patient L",
"iEraInfoId":0
}
]}
My java code to deserialize this code is :
String sRes = (String) clientResponse.getEntity(String.class);
List<ThsEraPostingDetailsBO> lst = new JSONDeserializer<List<ThsEraPostingDetailsBO>>()
.use(null, ThsEraPostingDetailsBO.class)
.deserialize(sRes);
Please help me to solve this issue. i searched many links but i didnt get any reliable solutions. All helps will be thankfull.