azure - 如何使用 Liquid 在 Azure 逻辑应用程序中从 xml 转换为 json

标签 azure liquid azure-logic-apps

我正在使用将 XML 转换为 JSON。 这是我的 XML 请求正文

<Root>
<test>
    <column1>value1</column1>
    <column2>value2</column2>
</test>
<test>
    <column1>value1</column1>
    <column2>value2</column2>
</test>
</Root>

这是我的液体 map

{
    "test": [
        {% for data in Root.test %}
        {
            "column1": "{{data.column1}}",
            "column2": "{{data.column2}}",
        }
        {% endfor %}
    ]
}

运行逻辑应用程序时,我遇到解析错误:

{
  "Code": "IncorrectLiquidTransformOutputType",
  "Message": "An error occurred while converting the transformed value to JSON. The transformed value is not a valid JSON. 'After parsing a value an unexpected character was encountered: {. Path 'test[0]'"
}

但是当我在液体沙箱中运行相同的代码时工作正常。我可否知道?逻辑应用程序存在什么问题。

最佳答案

我在我身边进行了测试,并在下面提供我的液体图供您引用:

{
    "test": [
        {% for data in content.Root %}
        {
            "column1": "{{data.column1}}",
            "column2": "{{data.column2}}"
        },
        {% endfor %}
    ]
}

运行这个液体贴图,它工作正常(如下图所示) enter image description here

希望对你有帮助~

关于azure - 如何使用 Liquid 在 Azure 逻辑应用程序中从 xml 转换为 json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61486553/

相关文章:

Azure逻辑应用程序: RequestEntityTooLarge error with the FTP connector

c# - .NETTY : Second batch of data sent includes the first?

Azure AD OAuth 客户端凭据授予流程

python - 使用 azure-mgmt-sql 从 SQL 托管实例获取数据库

search - 在SHOPIFY中添加 "items per page"下拉框

ruby-on-rails - 带有液体模板的 rails 上的 ruby

javascript - Ajaxify 链接,以便它仍然可以在单击时访问地址,但不会更改页面

sql-server - Azure逻辑应用程序: How do I pass a single For Each variable to an Execute Stored Procedure step?

powershell - 本地部署——更改默认位置

azure - 从逻辑应用程序调用函数应用程序时出错