Skip to content

Kirby 6.0.0

RequestResponse::json()

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

RequestResponse::json(array|string $body = '', int|null $code = null, bool $pretty = false, array $headers = []): RequestResponse

Parameters

Name Type Default
$body arrayorstring ''
$code intornull null
$pretty bool false
$headers array []

Return type

Kirby\Panel\Response\RequestResponse

Parent class

Kirby\Panel\Response\RequestResponse inherited from Kirby\Http\Response