Skip to content

Kirby 6.0.0

Response::json()

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

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

Parameters

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

Return type

Kirby\Http\Response

Parent class

Kirby\Http\Response