> For the complete documentation index, see [llms.txt](https://docs.cloud.hoverfly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloud.hoverfly.io/create-simulations/building-a-json-response/using-a-json-object-from-the-request.md).

# Using a JSON object from the Request

Learn how to use data from incoming JSON requests to dynamically build responses in Hoverfly Cloud using Handlebars templating.

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                          |
