Skip to content

Kirby 4.5.0

Response::json()

Creates a json response with appropriate header and automatic conversion of arrays.

Response::json(array|string $body = '', ?int $code = null, ?bool $pretty = null, array $headers = [ ]): Kirby\Http\Response

Parameters

Name Type Default
$body array|string ''
$code int|null null
$pretty bool|null null
$headers array [ ]

Return type

Kirby\Http\Response

Parent class

Kirby\Http\Response