public function withJson($data, int $status = null, int $options = 0)
        {
            $json = json_encode($data, $options);
            if ($json === false) {
                throw new \RuntimeException(json_last_error_msg(), json_last_error());
            }
            
            $response = $this->write($json);
            $response = $response->withHeader('Content-Type', 'application/json;charset=utf-8');
            
            if (isset($status)) {
                return $response->withStatus($status);
            }
            return $response;
        }