Skip to content

Kirby 6.0.0

JsonResponse::json()

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

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

Parameters

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

Return type

Kirby\Panel\Response\JsonResponse

Parent class

Kirby\Panel\Response\JsonResponse inherited from Kirby\Http\Response