Parse the JSON response body and return an array
array
RuntimeException if the response body is not in JSON format
public function json() {
$data = json_decode((string) $this->body, true);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
}
return $data ?: array();
}