how to access the key value in a object which is outside of the object.
Closed this issue · 4 comments
Sujata-060 commented
{
"isVisibleCondition": true,
"Questions": [
{
"QuestionChoices": [
{
"choiceTextInDefaultLanguage": "YES",
"isDefault": false,
"scoringValue": 0
},
],
"textDataType": 0
}
],
"visibleCondition": {
"filterConditions": [
{
"fieldCondition": {
"answerCode": "NO",
"questionCode": "Q3"
},
}
]
}
}, in this how to access isVisibleCondition" inside the answercode of visibleCondition
markmelville commented
This expression demos 3 ways to do it. https://try.jsonata.org/vusDWtfWM
$.(
$isViz:=isVisibleCondition;
visibleCondition.{
"filters": filterConditions,
"isViz": $$.isVisibleCondition, /* root input variable */
"isViz2" : %.isVisibleCondition, /* parent operator */
"isViz3": $isViz /* captured in variable */
}
)
BTW, you could have made this a lot easier with a well-formatted JSON.
Sujata-060 commented
Thank you for the response @markmelville , it helped me a lot
markmelville commented
On the exerciser page, there is a button to get an invite to the slack group. I suggest you join that to get more help.
mattbaileyuk commented
Thanks for helping out here, @markmelville 👍