> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/generic/xml-and-json-operations/get-key-value.md).

# 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>`

{% hint style="info" %}
**Note**: You can manually provide the key path or generate it automatically using the **Data Path Builder** available for the JSON input. The generated path can be used directly as the input for the Get Key Value action. To learn more,[ click here](/avo-assure/actions/generic/xml-and-json-operations/get-tag-value/data-path-builder.md).
{% endhint %}

| Argument                            | Description                                                            |
| ----------------------------------- | ---------------------------------------------------------------------- |
| <p>\<JSON\_input><br>(Required)</p> | Provide the JSON input from which the value needs to be retrieved.     |
| <p>\<path><br>(Required)</p>        | Provide the path of the key to retrieve its value from the JSON input. |

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                    | Description                                                        |
| ------------------------------------------- | ------------------------------------------------------------------ |
| <p>\<Dynamic Variable></p><p>(Required)</p> | This dynamic variable stores the fetched key value from JSON body. |
| <p>\<Dynamic Variable></p><p>(Optional)</p> | 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.

{% code overflow="wrap" expandable="true" %}

```json
// JSON Body 
{ 
  "CompanyData": { 
    "Departments": { 
      "Department": [ 
        { 
          "_deptId": "D001", 
          "name": "HR" 
        }, 
        { 
          "_deptId": "D002", 
          "name": "Finance" 
        }, 
        { 
          "_deptId": "D003", 
          "name": "QA" 
        } 
      ] 
    } 
  } 
} 
```

{% endcode %}

* **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**.

<figure><img src="/files/3fBFGEEZzyBsGAf8Oynp" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/xml-and-json-operations/get-key-value.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
