Home > database >  How to access child node of JSON in react? MobileRiskList is list how can we access?
How to access child node of JSON in react? MobileRiskList is list how can we access?

Time:04-09

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.

CodePudding user response:

The correct path is formJson.MobileLobList[0].MobileRiskList[0].isAppilcable.

Both MobileLobList and MobileRiskList are arrays and you must get the element by index.

  • Related