public function jsonSerialize()
    {
        $json = [];

        foreach (['code', 'message', 'description', 'uri'] as $field) {
            if ($this->$field !== null) {
                $json[$field] = $this->$field;
            }
        }

        return $json;
    }