Multi-condition extraction and filter extraction in jsonpath

Before creating expressions in JsonPath, you must understand two important symbols.

? : A question mark, marking the beginning of an expression. The syntax used [? (Expression)]
[? (Expression)]
@: Indicates the current node being processed at the symbol. The syntax uses $.books[?(@.price > 100)
3. When there are multiple conditions

$.data[?(@.attribute ==1&&@.productKind==2)].productId

Filter first and then take the value

result = jsonpath.jsonpath(r, "$..[?(@.compareDataCode != None)..compareDataCode]")
print(result)
jsonpath.jsonpath(res, f"$..[?(@.containRoute == True && @.containThreeD == True && @.groupKey == \"{groupKey}\")..sessionIds]")

Guess you like

Origin blog.csdn.net/weixin_42550871/article/details/124406217