src/Cookie.php
public function toJson() : string
    {
        $json = json_encode($this->data);

        if (false === $json) {
            throw JsonException::fromJsonEncodeError(json_last_error_msg());
        }

        return $json;
    }
public function toJson() : string
    {
        $json = json_encode($this->data);

        if (false === $json) {
            throw JsonException::fromJsonEncodeError(json_last_error_msg());
        }

        return $json;
    }
public function toJson ( ) : string { $ json = json_encode ( $ this -> data ) ; if ( false === $ json ) { throw JsonException :: fromJsonEncodeError ( json_last_error_msg ( ) ) ; } return $ json ; }
Serializes the cookie data as JSON.

@throws JsonException When an error occurs during encoding
Serializes the cookie data as JSON .