delpha
delpha

Reputation: 970

azure logic apps, get the key of a json response

I have a logic apps that sends a request and expect a response. the response has an important value, but it comes as a key, and I need to store it in a variable. how can I get this key and store as a value.

eg: {"subscriptions": {"ABC": "true"}} -> I need to get "ABC" and store it in a variable, something like ->initialize variable -> var_abc="ABC"

Upvotes: 0

Views: 2217

Answers (2)

delpha
delpha

Reputation: 970

I guess the best way is to use Javascript code component as it is part of Azure Logic Apps now. This is very powerful and it allows playing with data and objects with javascripts. https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-add-run-inline-code

Upvotes: 1

Hury Shen
Hury Shen

Reputation: 15724

You can use "Parse JSON" action and use your response json data as the content of this action. Then click "Use sample payload to generate schema" at the bottom of this action and input your json to generate the schema.

enter image description here

Now you can use "initialize variable" action to initialize a variable and set the value with the data of "ABC" enter image description here

Upvotes: 0

Related Questions