如何在Azure Logic应用中将两个JSON键值对组合为一个?

时间:2019-08-28 08:25:49

标签: json azure logic logical-operators azure-logic-apps

我正在尝试在Azure Logic应用中将JSON的两个键值对组合为一对。

当我在撰写操作中使用此代码时:

"Compose": {
            "inputs": {
                "financelInformation": "@body('HTTP')['currency']",
                "amount": "@body('HTTP')['amount']
            }
}

它将创建以下JSON输出:

{"financelInformation":"eur", "amount": "499"}

但是我想要实现的是以下输出:

{"financelInformation":"499 eur"}

到目前为止,我已经尝试过:

"Compose": {
            "inputs": {
                "financelInformation": "@body('HTTP')['amount']['currency']",        
                "financelInformation": "@body('HTTP')['amount'] '-' ['currency']",        
            }
}

以上两次尝试均无效,希望有人能帮忙!

谢谢!

1 个答案:

答案 0 :(得分:0)

这是您想要的答案吗? (我发布了两个屏幕快照,但是我初始化了两个与您的http正文不同的变量,我认为您只需要在两个值之间输入一个空格即可)

enter image description here

enter image description here

更新

我再次使用http操作的值对其进行测试,我从http操作获得了两个值。我的撰写操作中的代码是

"inputs": {
     "financelInformation": "@{body('HTTP')['id']} @{body('HTTP')['name']}"
}

您可以参考一下。