Menu
Choose a product
Viewing: v1.7.x (latest)
Find another version
Scroll for more
Open source
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.
This method takes an object argument where the following properties can be set:
| Param | Type | Description |
|---|---|---|
| selector | string | An optional selector can be specified to extract a specific part of the data, see here for selector syntax. |
Returns
| Type | Description |
|---|---|
| Object or array | Returns the response body as JSON object. |
Example
JavaScript
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());
}Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.