简体   繁体   中英

Azure Logic Apps HTTP response body to SQL row

The question concerns Azure Logic Apps and how to parse JSON data in a workflow in order to store it to the sql database.

I have a problems to select content from JSON array that I'm receiving from HTTP request. Body is not empty because it's visible in previous step output. I would like to insert content to SQL database. The question is that how can I choose a specific content from parse_JSON Body? What should I type in expression field?

{
   "key":"value",
   "key1": {
        "key1.1":"value",
        "key1.2":"value"
     },
   "key2":"value"
},
{
   "key":"value",
   "key1":"value",
   "key2":"value"
}

工作流程 表达式字段

Firstly your json format is wrong, suppose it should be like the below.

[{
   "key":"value1",
   "key1": {
        "key1.1":"value2",
        "key1.2":"value3"
     },
   "key2":"value4"
},
{"key":"value",
   "key1":"value",
   "key2":"value"}]

Then is about the parse_json, if your json format is fixed, you could use Parse_json , mostly you could select the specific property from the dynamic content. And if not you could write the expression to implement. Like to get the value from key1.1 , the expression should be body('Parse_Json')[0]['key1']['key1.1'] , the 0 is the index in the array.

在此处输入图片说明

And if the format is not fixed, just use the Compose action, and compose could not select property with dynamic content so if want to get like key4 value, the expression should be outputs('Compose')[1]['key4'] .

在此处输入图片说明

And this is my test result.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM