src/UniversalJsonSerializer.php
public static function serialize($value): string
    {
        $serialized = json_encode(
            self::encode($value, new SplObjectStorage()),
            JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
        );

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException(json_last_error_msg());
        }

        return $serialized;
    }
public static function serialize($value): string
    {
        $serialized = json_encode(
            self::encode($value, new SplObjectStorage()),
            JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
        );

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException(json_last_error_msg());
        }

        return $serialized;
    }
public static function serialize ( $ value ) : string { $ serialized = json_encode ( self :: encode ( $ value , new SplObjectStorage ( ) ) , JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ InvalidArgumentException ( json_last_error_msg ( ) ) ; } return $ serialized ; }
Serialize the given value into a JSON encoded string.

@param mixed $value The value to be serialized.

@return string The JSON encoded string.
Serialize the given value into a JSON encoded string .