flexjson.JSONException:无法实例化抽象类或接口

时间:2016-10-25 09:02:36

标签: java json rest flexjson

我很擅长使用JSON第三方API FlexJson。我正在使用这个jar将JSON反序列化为java Object(用户定义)。该类包含两个数组对象。当我使用这个jar将这个json反序列化为我的对象时发生错误。错误是“flexjson.JSONException:无法实例化抽象类或接口”。我从服务器获取响应字符串使用REST Web服务:

{"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
    }
]}

我要反序列化此代码的java代码是:

String sRes = (String) clientResponse.getEntity(String.class);
List<ThsEraPostingDetailsBO> lst = new JSONDeserializer<List<ThsEraPostingDetailsBO>>()
    .use(null, ThsEraPostingDetailsBO.class)
    .deserialize(sRes);

请帮我解决这个问题。我搜索了许多链接,但我没有得到任何可靠的解决方案。所有的帮助都会感激不尽。

0 个答案:

没有答案