简体   繁体   English

液体模板 - 物品 ID

[英]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.

相关问题 在液体模板中迭代数组对象 - Iterate array object in liquid template Azure Logic Apps - Liquid Connector - 液体模板引擎的版本/风格? - Azure Logic Apps - Liquid Connector - version/flavor of liquid template engine? 如何解析液体模板中的collan定界数据 - How to parse collan delimited data in liquid template 液体模板转换在 Azure 逻辑应用程序中不起作用 - Liquid template transformation is not working in Azure Logic app 获取 XML 节点和子节点 xml 的液体模板,原样为 json 格式 - Liquid template to get XML node and child nodes xml as it is to json format Azure API管理套装-带液体模板 - Azure API Management Set-Body with liquid template Xml 到 Json 液体模板停止在 Azure 逻辑应用程序上工作 - Xml to Json liquid template stopped working on Azure Logic Apps Azure Liquid 模板 - 如何从 Apim 策略中的嵌套 json 获取特定值 - Azure Liquid template - how to get specifc value from nested json in Apim policy 如何使用Azure API-Management set-body中的液体模板解析查询字符串? - How can I parse a querystring using liquid template in Azure API-Management set-body? 在最近的 Azure API 管理升级后,为什么以前稳定且有效的 Liquid 模板会失败? - Why would a previously stable and working Liquid template fail after the most recent Azure API Management upgrade?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM