I'm getting frustrated with an "Unknown field" error when I invoke deserializeStrict. Simple application, all strings...
My apex class contains this public class:
public class CustomerInfo{
public String CustomerNo {get; set;}
public String CustomerName {get; set;}
public String Address1 {get; set;}
public String Address2 {get; set;}
public String City {get; set;}
public String State {get; set;}
public String Zip {get; set;}
public String County {get; set;}
public String Country {get; set;}
public String CreditBlock {get; set;}
public String CreditLimit {get; set;}
}
Field names are all correct, I have hard-coded the strings that are returned from the webservice... HTTPResponse res = h.send(req); CustomerInfo newCust = (CustomerInfo)System.JSON.deserializeStrict(res.getBody(), CustomerInfo.class);
The data comes back correctly formatted:
{"Address1":"address1 east 1st street","Address2":"suite 305","City":"Walnut","Country":"United States","County":"Douglas","CreditBlock":"No","CreditLimit":"500000","CustomerName":"My Test Customer","CustomerNo":"123456","State":"IA","Zip":"51323"}
Error in devloper console log:
"common.apex.runtime.impl.ExecutionException: Unknown field: JSONTest.CustomerInfo.GetCustomerInfoResult"|0x569159be
ANY help is greatly appreciated! I don't know what else to do, if I use deserialze rather than deserializeStrict all values in the new object are null...