Get Key Value
This is pre-built Action located under the @Generic Element. The functionality of this Action in Avo Assure is to fetch the key value based on the input provided and store the result in a dynamic variable.
Syntax
Input Value: <JSON_input>;<path>
<JSON_input> (Required)
Provide the JSON input from which the value needs to be retrieved.
<path> (Required)
Provide the path of the key to retrieve its value from the JSON input.
Output Value: <Dynamic Variable>;<Dynamic Variable>(Optional)
<Dynamic Variable>
(Required)
This dynamic variable stores the fetched key value from JSON body.
<Dynamic Variable>
(Optional)
This dynamic variable stores the status as True, False, or None.
Example: Retrieving a Key Value from a JSON Input Using Key Path
In this example, we explain how to retrieve a specific key value from a JSON input using a nested key path with array indexing.
Action: Get Key Value
Input Value: <JSON_input>;CompanyData.Departments.Department[2]._deptId
The first argument (<JSON_input>) specifies the JSON input from which the key value is retrieved.
The second argument (CompanyData.Departments.Department[2]._deptId) specifies the key path used to locate the required value. The array index ([2]) specifies the third object inside the Department array.
Output Value: {DeptId};{Status}
The first output variable ({DeptId}) stores the retrieved key value as D002.
The second output variable ({Status}) stores the execution result with the following possible values:
True: If the key value is retrieved successfully.
False: If the key path does not exist or the JSON input is invalid.
Logical Explanation: The Get Key Value action fetches the value from the Input Value column (<JSON_input>;CompanyData.Departments.Department[2]._deptId) and searches for the specified key path in the JSON input. The action navigates through the nested structure, accesses the third Department object using array index [2], retrieves the _deptId value (D002), and stores it in the {DeptId} variable. The execution result is stored in the {Status} variable as True.

Last updated