Is there a way to set a value to null with JMESPath? In my example, the value should be set to null if qux_1
is not null and else the value should be set to the value of baz
.
I thought the ternary operator could be read as if else condition but null would be evaluated as false?
import jmespath
o = {
"foo": {
"bar": {"baz": 4321},
"bar_1": {"baz_1": {"qux_1": 1234}}
}
}
jmespath.search("(foo.bar_1.baz_1.qux_1 && null)||foo.bar.baz", o)