在nunjucks中穿过物体?

j_d*_*j_d 7 javascript json nunjucks

我有一个名为"list.json"的文件设置如下:

{
  "thing1": "Thing1",
  "thing2": "Thing2",
  "thing3": "Thing3"
}
Run Code Online (Sandbox Code Playgroud)

我怎么能循环呢?我想做的事情如下:

{% for item in list%}
  <option>{{ thing }}</option>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

Nik*_*wal 5

您可以尝试以下

{% for key, item in list%}
  <option>{{ item }}</option>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)