After deserializing a JSON response and casting it to the wrapper class, I see that in the debug logs half of the JSON is missing.
Am I deserializing the JSON incorrectly? Or am I not creating a correct data structire for the JSON?
public with sharing class MyController {
public list<JSONWrapper> wrapper {get;set;}
public void getDeserialize() {
string jsonresponse = '[{"appList":[{"dealerID":"ABC123","dealerName":"ABC Auto Dealer", "reportingPeriod":"2019-05- 18","fsitCode":"FIFS","idl":"Y","casCode":"STEONE","submissionCount":2},{"dealerID": "ABC123","dealerName":"ABC Auto Dealer","reportingPeriod":"2019-06-27","fsitCode":"FIFS","idl":"Y", "casCode":"STEONE","submissionCount":5}],"eclist": [{"dealerID":"XL1HX","submitUserID":"BCUSER1","bookedDate":"2019-05-22 00:00:00.0","ecEligible":"Y","caBookedCount":1,"ecBookedCount":0},{"dealerID":"XL1HX","submitUserID": "BCUSER1","bookedDate":"2019-06-05 00:00:00.0","ecEligible":"Y","caBookedCount":1,"ecBookedCount": 0}]}]';
system.debug('json string is ' +jsonresponse);
wrapper = (list<JSONWrapper>) JSON.deserialize(jsonresponse, list<JSONWrapper>.class);
system.debug('This is the wrapper' +wrapper);
}
}
public class JSONWrapper {
public List<ApplicationList> appList{get;set;}
public List<ElectronicContractList> eclist {get;set;}
public class ElectronicContractList{
public String dealerID{get;set;}
public String submitUserID{get;set;}
public String bookedDate{get;set;}
public String ecEligible{get;set;}
public Integer caBookedCount{get;set;}
public Integer ecBookedCount{get;set;}
}
public class ApplicationList {
public String dealerID{get;set;}
public String dealerName{get;set;}
public String reportingPeriod{get;set;}
public String fsitCode{get;set;}
public String idl{get;set;}
public String casCode{get;set;}
public Integer submissionCount{get;set;}
}
}
|DEBUG|This is the wrapper :
**strong text**(JSONWrapper:[appList=
(ApplicationList:[casCode=STEONE, dealerName=ABC Auto Dealer,
fsitCode=FIFS, idl=Y, reportingPeriod=2019-05-18, dealerID=XL1HX,
submissionCount=2],
ApplicationList:[casCode=STEONE, dealerName=ABC Auto Dealer,
fsitCode=FIFS, idl=Y, reportingPeriod=2019-06-27,
dealerID=XL1HX, submission**strong text**