'How to access child node of JSON in react? MobileRiskList is list how can we access?
formJson
{
"NTLFee": 0,
"OperationType": "Y",
"MobileLobList": [
{
"GrossPremium": 1227.72,
"MobileCoverageList": [
{
"Vat": 0
}
],
"MobileElementId": 195490042,
"MobileId": 195490040,
"MobileRiskList": [
{
isAppilcable=’Y’
}
]
]
When I am wirting this.form.OperationType == ‘Y’ -> this is working fine
But now,
I want to write condition for isAppilcable in react.
But when I tried this.form.isAppilcable == ‘Y’ -> this is not working as it is child node.
The path is formJson=> MobileLobList => MobileRiskList=> isAppilcable
Can you please help me out how can I access this child node in react.
Solution 1:[1]
The correct path is formJson.MobileLobList[0].MobileRiskList[0].isAppilcable.
Both MobileLobList and MobileRiskList are arrays and you must get the element by index.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BiciAP |
