我正在使用将 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 %}
]
}
希望对你有帮助~
关于azure - 如何使用 Liquid 在 Azure 逻辑应用程序中从 xml 转换为 json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61486553/