I'm facing an issue detailed below.
API:
"Data": [
{
"Id": 90110,
"Name": "John",
"Surname": "Doe",
"Email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="472d282f2923282207202a262e2b6924282a">[email protected]</a>",
"Status": "Active"
},
{
"Id": 90109,
"Name": "Sally",
"Surname": "Doe",
"Email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f281939e9e8b969d97b2959f939b9edc919d9f">[email protected]</a>",
"MiddleName":"II",
"Status": "Active"
}]
Upon parsing the JSON to my typescript class, I noticed that the MiddleName property remains undefined. This is causing issues when exporting to Excel using the 'xlsx' library as shown in the image below. How can I address this problem and set a default value for null or undefined properties?
User Export P.S : I am using 'xlsx' library for excel export.