protected function formatJson($response)
{
$response->getHeaders()->set('Content-Type', 'application/json; charset=UTF-8');
if ($response->data !== null) {
$options = $this->encodeOptions;
if ($this->prettyPrint) {
$options |= JSON_PRETTY_PRINT;
}
$response->content = Json::encode($response->data, $options);
}
}