[英]Liquid Template - Item ID
Can someone please assist how can I pull the itemid from the below using a liquid template?:有人可以帮助我如何使用液体模板从下面提取 itemid 吗?:
{
"orders": [
{
"id": 3688882438313,
"line_items": [
{
"id": 9698678243497
},
{
"id": 9698678276265
}
]
}
]
}
I can get the order id from the following template:
{
"Order" : [
{% for order in content.orders%}
{
"ID" : "{{ order.id }}",
},
{% endfor %}
]
}
But cannot seem to pull the item ID no matter what I try and advice would be greatly appreciated.但无论我尝试什么,似乎都无法提取项目 ID,我们将不胜感激。
For your requirement, here provide a sample of liquid for your reference:根据您的要求,这里提供一个液体样品供您参考:
{
"Order" : [
{% for order in content.orders%}
{
"ID" : "{{ order.id }}",
"ItemIds": [
{% for item in order.line_items%}
{
"itemId": "{{item.id}}"
},
{% endfor %}
]
},
{% endfor %}
]
}
Run the liquid above, we can get the result:运行上面的液体,我们可以得到结果:
{
"Order": [
{
"ID": "3688882438313",
"ItemIds": [
{
"itemId": "9698678243497"
},
{
"itemId": "9698678276265"
}
]
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.