2

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"
}

Workflow Expression field

1 Answer 1

1

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.

enter image description here

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'].

enter image description here

And this is my test result.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the answer! I managed to solve the problem by using Code View-window. In there I just typed "@items('For_each')?['key 1']?['key1.1']".
@Mr. H, I don't see the for_each action in your pic. So you need get the value in a loop?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.