---
title: "Response.json( [selector] ) | Grafana k6 documentation"
description: "Parses the response body data as JSON and returns a JS object or array."
---

# Response.json( \[selector] )

Parses the response body data as JSON and returns a JS object or array. This call caches the deserialized JSON data, additional calls will return the cached data. An optional selector can be specified to extract a specific part of the data, see [here for selector syntax](https://github.com/tidwall/gjson#path-syntax).

This method takes an object argument where the following properties can be set:

Expand table

| Param    | Type   | Description                                                                                                                                                 |
|----------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| selector | string | An optional selector can be specified to extract a specific part of the data, see [here for selector syntax](https://github.com/tidwall/gjson#path-syntax). |

### Returns

Expand table

| Type            | Description                               |
|-----------------|-------------------------------------------|
| Object or array | Returns the response body as JSON object. |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import http from 'k6/http';

export default function () {
  const res = http.get('https://quickpizza.grafana.com/api/json?foo=bar');

  console.log(res.json());
}
```
