我有一个名为“list.json”的文件,设置如下:
{
"thing1": "Thing1",
"thing2": "Thing2",
"thing3": "Thing3"
}
我怎样才能遍历这个?我想做类似的事情:
{% for item in list%}
<option>{{ thing }}</option>
{% endfor %}
最佳答案
你可以试试看
{% for key, item in list%}
<option>{{ item }}</option>
{% endfor %}
关于javascript - 循环遍历 nunjucks 中的对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34902813/