Get value from data set returning undefined
I am trying to get 2 values from the following data set however I get undefined values when I log the result.
{
"categoryDescription": "NR",
"bopCategoryCode": "Z",
"forexBOPCategory": {
"bopSubcategoryCode": "00",
"rulingCode": "NA",
"rulingOrSubcategoryDescription": "PS",
"straightThroughProcess": "N",
"categoryFlow": "I",
"transferType": "I",
"clientType": "NA",
"sdaAllowed": "Y",
"fcaAllowed": "N",
"otherAllowed": "Y",
"sdaRequireDocument": "Y",
"documentCount": 1,
"requiredDocumentCount": 0,
"thirdPartyCapture": "N",
"clientResidentialStatus": "Y",
"bopPaymentRelation": "Y",
"forexBOPCategoryDocumentsList": [
{
"bopCategoryCode": "ZZ1",
"rulingCode": "NA",
"documentDescription": "Document Desc",
"documentShortDescription": "Document S Desc",
"bopSubcategoryCode": "00"
}
]
}
}
From the above I need to get the rulingOrSubcategoryDescription and documentShortDescription
Here is my attempt:
this.formData.documentShortDescription = response.forexBOPCategory[0]?.forexBOPCategoryDocumentsList[0].documentShortDescription;
this.formData.rulingOrSubcategoryDescription = response.forexBOPCategory[0]?.rulingOrSubcategoryDescription;