The data is
data_case_c = {
"qualities": {
"id": "0123456789",
"key_criteria": "Target",
"desired_value": {"id": "987654321", "label": "CORRECT"},
}
}
I want to check that key_criteria
is Target
. And if it is, also check that desired_value[label]
is CORRECT
.
Here is the query I thought might work
query = "qualities.key_criteria == 'Target' | qualities.desired_value.label == 'CORRECT'"
It returns False, which is incorrect for what I want since qualities.key_criteria
equals Target
and qualities.desired_value.label
equals CORRECT
This returns True.
query = "qualities.key_criteria == 'Target'"
Basically I guess I need to get the qualities
object passed to the next expression when the first evaluates to True
. How do I do that?