The data is
data_case_c = {
"qualities": {
"id": "0123456789",
"key_criteria": "Target",
"desired_value": {"id": "987654321", "label": "CORRECT"},
}
}
I want check that key_criteria
is Target
. And if it is, return qualities.desired_value.label
, which is CORRECT
in this case.
Here is the query I thought might work
query = "qualities.key_criteria == 'Target' | qualities.desired_value.label"
It returns None
.
The first half of the expression returns True
.
query = "qualities.key_criteria == 'Target'"
How can I return the actual value of qualities.desired_value.label
when a key on the same level as desired_value
matches a specific criteria?