public function json(array $data)
    {
        $data = json_encode($data);
        $response = $this->withHeader('Content-Type', 'application/json');
        $response->getBody()->write($data);

        return $response;
    }