Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/latest/javascript-api/k6-http/response/response-json.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/latest/javascript-api/k6-http/response/response-json/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
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
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

