Im trying to deserialize a JSON to object. The JSON response looks like this :
{
"o_gpid": 2000000237,
"o_bilreq": "BR-0000000371",
"o_netrv": "3603000000",
"o_ucogs": "3120900000",
"o_ntgp2": "482100000",
"o_prgp2": "13.3805162",
"o_ntfip": "303000000",
"o_ntgp3": "179100000",
"o_prgp3": "4.97085762",
"it_zgpbill": [
{
"gpid": 2000000237,
"bilreq": "BR-0000000371",
"posbr": 1,
"vbeln": "3055",
"posnr": 1,
"matnr": "PC200-8M0/S1",
"sernr": "SNOKT01",
"netrv": "1201000000",
"ucogs": "1040300000",
"ntgp2": "160700000",
"prgp2": "13.381",
"ntfip": "101000000",
"ntgp3": "59700000",
"prgp3": "4.971"
},
{
"gpid": 2000000237,
"bilreq": "BR-0000000371",
"posbr": 1,
"vbeln": "3055",
"posnr": 1,
"matnr": "PC200-8M0/S1",
"sernr": "SNOKT02",
"netrv": "1201000000",
"ucogs": "1040300000",
"ntgp2": "160700000",
"prgp2": "13.381",
"ntfip": "101000000",
"ntgp3": "59700000",
"prgp3": "4.971"
},
{
"gpid": 2000000237,
"bilreq": "BR-0000000371",
"posbr": 1,
"vbeln": "3055",
"posnr": 1,
"matnr": "PC200-8M0/S1",
"sernr": "SNOKT03",
"netrv": "1201000000",
"ucogs": "1040300000",
"ntgp2": "160700000",
"prgp2": "13.381",
"ntfip": "101000000",
"ntgp3": "59700000",
"prgp3": "4.971"
}
],
"it_zsfgp_pmp": [],
"it_zsfsapgp": [
{
"stat": "S",
"msgnr": "000",
"natxt": "Success"
}
]
}
And from that JSON, I created class object like this :
Public class BRD_Recalculate_Response {
Public String o_gpid;
Public String o_bilreq;
Public String o_netrv;
Public String o_ucogs;
Public String o_ntgp2;
Public String o_prgp2;
Public String o_ntfip;
Public String o_ntgp3;
Public String o_prgp3;
Public List<it_zgpbill> it_zgpbill;
Public List<it_zsfgp_pmp> it_zsfgp_pmp;
Public List<it_zsfsapgp> it_zsfsapgp;
}
Public class it_zgpbill {
Public String gpid;
Public String bilreq;
Public String posbr;
Public String vbeln;
Public String posnr;
Public String matnr;
Public String sernr;
Public String netrv;
Public String ucogs;
Public String ntgp2;
Public String prgp2;
Public String ntfip;
Public String ntgp3;
Public String prgp3;
}
Public class it_zsfgp_pmp {
}
Public class it_zsfsapgp {
Public String stat;
Public String msgnr;
Public String natxt;
}
But when I try to deserialize it using
List<BRD_Recalculate_Response> BRD_Recalculate_Response = (List<BRD_Recalculate_Response>)JSON.deserialize(responseString, List<BRD_Recalculate_Response>.class);
Im getting error :
Malformed JSON: Expected '[' at the beginning of List/Set