Home > database >  Get "Value" from simple JSON using "Key" as variable Azure Logic Apps
Get "Value" from simple JSON using "Key" as variable Azure Logic Apps

Time:02-10

I have defined a simple JSON

{
  "12345": "Numbers",
  "AAAAA": "AllAs",
  "ABCXYZ": "AtoZ"
}

All I want to extract the value of "Key" when passed as a variable. I have tried body('Parse_JSON')['name'] but its failing.

I just want to get the value of what ever Key I am looking for as variable.enter image description here

CodePudding user response:

As per your comment as you are initializing ABCXYZ value and that you have already declared in inputs you can just type ABCXYZ in value rather than calling Name variable

enter image description here

CodePudding user response:

Figured it !

body('parse_JSON')?[variables('name')]

The above does the following:

1- body('parse_JSON') gets the body of Parsed JSON

2- ?[variables('name')]gets the value of name which is equal to ABCXYZ

3- Returns AtoZ

  • Related