is there a way to catch all fields that have not been set in a class ? i am parsing a json file and sometimes field names change and i would like to know which fields have not been set to make it simpler to fix. Below is a sample of my code i use to sett the fields in class. This is only small sample , my class has over 250 fields so checking one by one is not going to work.
const myLand = new mls.Land();
myLand.landLease = trimString(data["LAND LEASE?"]);
myLand.commonInterest = trimString(data["COMMON INTEREST"]);
myLand.landLeaseAmount = trimString(data["LAND LEASE AMOUNT"]);
myLand.landLeaseAmtFreq = trimString(data["LAND LEASE AMT FREQ"]);
myLand.landLeasePurch = trimString(data["LAND LEASE PURCH?"]);
myLand.landLeaseRenew = trimString(data["LAND LEASE RENEW"]);
newListing.land = myLand;
and here is the Trim function
function trimString(inputStr: string) {
return (inputStr !== undefined && typeof inputStr === "string") ? inputStr.trim() : undefined;
}