【发布时间】:2015-02-18 04:26:09
【问题描述】:
如果我有这个:
"attributes": {
"color": [
{
"id": 29907472,
"name": "Green",
"displayType": 5,
"image": "/_assets/img/products/tshirt-green.png",
"price": null
},
{
"id": 29907473,
"name": "Turquoise",
"displayType": 5,
"image": "",
"price": null
},
{
"id": 29907474,
"name": "Teal",
"displayType": 5,
"image": "",
"price": null
}
]
},
并且只想输出液体中颜色的名称,我需要怎么做?我试过了
{% for name in attributes.color %}
{{ name }}
{% endfor %}
但我只得到这个作为输出:[id, 29907472][name, Green][displayType, 5][image, /_assets/img/products/tshirt-green.png][price, ] [id, 29907473][name, Turquoise][displayType, 5][image, ][price, ] [id, 29907474][name, Teal][displayType, 5][image, ][price, ]
我哪里错了?对不起,液体初学者。
【问题讨论】:
标签: liquid