如何在Azure Logic Apps中使用Compose操作使用更改JSON结构?

时间:2019-07-24 08:07:38

标签: json azure api azure-logic-apps compose

我正在尝试更改从使用Logic应用程序发出的请求中得到的JSON响应:

enter image description here

此请求将获得以下响应:

{
"invoiceID":1,
"formType":"invoice",
"amount":449,
"currency":"eur",
"description":"Invoice real estate",
"period":{"end":20122019,"start":20122020},
"owner":{
   "id":91434,
   "firstname":"John",
   "lastname":"Doe",
   "dateOfBirth":1121993,
   "phoneNumber":345435435,
   "countryOfBirth":"Nederland",
   "IBAN":"NL28 ABNA 743734g763474324"
},
"property":{
   "id":105,
   "type":"apartment",
   "address":"ghost lane 13",
   "ZIP":"7888 CK",
   "State\/Province":"Groningen",
   "country":"Nederland",
   "construction-year":15072009,
   "previousOwners":9
},
"previousProperties":[54,193,11,454,18]
}

现在我正在尝试将上述JSON组合为另一个json结构,例如:

{
"general": {
    "invoiceID": 12,
    "formType": "invoice",
    "amount": 449,
    "currency": "eur",
    "description": "Invoice real estate",
    "period": {
       "end": 20122019,
       "start": 20122020
    }
 }
 }

我尝试为此使用Compose操作:

enter image description here

最后我返回响应:

enter image description here]]

此设置无效,并且出现以下错误:

{“错误”:{“代码”:“ NoResponse”,“消息”:“服务器didbnt收到上游服务器的答复。该请求的跟踪ID是08586376520125765844944852801CU36。”}}

当我从逻辑应用程序设计器中删除Compose操作时,该流程确实起作用,但是我得到了原始的JSON响应。

更新

我的撰写配置有以下选项:

enter image description here enter image description here

希望有人可以帮助我!

1 个答案:

答案 0 :(得分:0)

在您的图片中,您的Response主体设置了HTTP操作主体,您需要设置#ifndef MAIN_H #define MAIN_H #endif // MAIN_H 输出,以下是我的测试结果,但我没有得到您的错误。也许你可以看看。看起来,在您的撰写操作中,您将值设置为错误的值,根据您的要求,您需要使用Compose来获取操作输出。

我使用HTTP触发器进行测试。

enter image description here

以下是我的撰写内容:

HTTP

这是邮递员得到的答复。

enter image description here

希望这可以为您提供帮助。