Jinja2 check if value exists in list of dictionaries
问题 I am trying to check if a value exists inside a list with dictionaries. I use flask 1.0.2. See example below: person_list_dict = [ { "name": "John Doe", "email": "johndoe@mydomain.com", "rol": "admin" }, { "name": "John Smith", "email": "johnsmith@mydomain.com", "rol": "user" } ] I found two ways to solve this problem, can you tell me which is better?: First option: jinja2 built-in template filter "map" <pre>{% if "admin" in person_list_dict|map(attribute="rol") %}YES{% else %}NOPE{% endif %}