# Using a JSON object from the Request

You can retrieve any part of a JSON Request payload using the following syntax in the response body. (Note that there are similar functions for working with XML should you need to, as well as for working with JSON that is generated from XML)

```handlebars
{{ Request.Body 'JSONpath' '<<JSONpath query expression>>' }}
```

### Example: Using a JSON object from the Request

| **Request Body**                                                                                                          | **Templating script**                            | **Resulting Response Body** |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | --------------------------- |
| <p>{</p><p>"person":</p><p>{</p><p>"name": "John",</p><p>"surname": "Doe"</p><p>}</p><p>}</p>                             | {{ Request.Body 'JSONpath' '$.person.name' }}    | John                        |
| <p>{</p><p>"people": \[</p><p>{</p><p>"name": "John",</p><p>"surname": "Doe",</p><p>"age": 30</p><p>}</p><p>]</p><p>}</p> | {{ Request.Body 'JSONpath' '$.people\[0].age' }} | 30                          |


---

# Agent Instructions: 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:

```
GET https://docs.cloud.hoverfly.io/create-simulations/building-a-json-response/using-a-json-object-from-the-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
