Reputation: 181
set x = {'a':1}
how to find out if x is a dictionary in jinja? I tried to say if iterable but that can't differentiate between list, string, or dictionary. I want to know if a variable is a dictionary.
Upvotes: 7
Views: 5396
Reputation: 163
With mapping filter, like
{% if x is mapping %}
do something
{% endif %}
Upvotes: 8