public function json($data, $status = HttpMessage::HTTP_OK, $encodingOptions = 0)
    {
        $json = json_encode($data, $encodingOptions);
        $this->withStatusCode($status)
            ->withHeader('content-type', 'application/json')
            ->getBody()->write($json);
        return $this;
    }