0

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.

Boris Schegolev
  • 3,601
  • 5
  • 21
  • 34
Marvel John
  • 193
  • 1
  • 3
  • 14
  • What is the definition of `ThsEraPostingDetailsBO`? – Boris Schegolev Oct 25 '16 at 10:55
  • 'public class ThsEraPostingDetailsBO implements Serializable{ private EobPaymentDetails[] eobPaymentDetails; private EraPostingDetails[] eraPostingDetails; public EobPaymentDetails[] getEobPaymentDetails() { return eobPaymentDetails; } public void setEobPaymentDetails(EobPaymentDetails[] eobPaymentDetails) { this.eobPaymentDetails = eobPaymentDetails; } public EraPostingDetails[] getEraPostingDetails() { return eraPostingDetails; } public void setEraPostingDetails(EraPostingDetails[] eraPostingDetails) { this.eraPostingDetails = eraPostingDetails; } }' – Marvel John Oct 27 '16 at 11:43

0 Answers0