is there a better way to check of empty data in JSON data ?
Here is the type of JSON I have, sometimes data is missing, which is normal :
{
  "sumRatings": "Private info",
  "phoneNum": "Private info",
  "firstname": "Private info",
  "email": "Private info",
  "fullname": "Private info",
  "talentType": "Private info",
  "ratingCount": "Private info",
  "creationTime": "Private info",
  "lastname": "Private info",
  "currentPosition": "Private info",
  "rgpd": "Private info",
  "bio": "Private info",
  "company": "Private info",
  "whatsapp": "Private info",
  "emptyComs": "Private info",
  "id": "Private info"
}
Here is how I did it :
for (const item of allDocs) {
  var generalData = {
    bio: item.bio == undefined ? null : item.bio,
    fullname: item.fullname == undefined ? null : item.fullname,
    company: item.company == undefined ? null : item.company,
    position: item.position == undefined ? null : item.position,
    profilImg: item.profilImg == undefined ? null : item.profilImg,
    talentType: item.talentType == undefined ? null : item.talentType,
    rating: item.rating == undefined ? null : item.rating,
    contacts: {
      gmeets: item.gmeets == undefined ? null : item.gmeets,
      zoom: item.zoom == undefined ? null : item.zoom,
      phone: item.phone == undefined ? null : item.phone,
    },
    skills: item.skills == undefined ? null : item.skills,
    email: item.email == undefined ? null : item.email,
    firstname: item.firstname == undefined ? null : item.firstname,
    lastname: item.lastname == undefined ? null : item.lastname,
    phone: item.phoneNum == undefined ? null : item.phoneNum,
    ratingCount:
      item.ratingCount == undefined ? null : item.ratingCount,
    sumRatings: item.sumRatings == undefined ? null : item.sumRatings,
    currentPosition:
      item.currentPosition == undefined ? null : item.currentPosition,
    creationTime:
      item.creationTime == undefined ? null : item.creationTime,
    rgpd: item.rgpd == undefined ? null : item.rgpd,
    emptyComs: item.emptyComs == undefined ? null : item.emptyComs,
  };
  console.log(generalData);
}
I wonder if there is a way to avoid puting ... == undefined ? null : ... on every line.
Maybe a function that would take the item atributes, check if they are undefined and return "null" if undefined or the actual value if not undefined.
 
     
     
     
    