@Override
    public byte[] serialize(Object object) throws SerializationException {
        if (object == null) {
            return new byte[0];
        }
        try {
            if (config.isJSONB()) {
                return JSONB.toBytes(object, config.getWriterFeatures());
            } else {
                return JSON.toJSONBytes(object, config.getWriterFeatures());
            }
        } catch (Exception ex) {
            throw new SerializationException("Could not serialize: " + ex.getMessage(), ex);
        }
    }
Fastjson for Spring Data Redis Serializer(Generic implement).

@author lihengming
@author Victor.Zxy
@see RedisSerializer
@since 2.0.23
extension-spring6/src/main/java/com/alibaba/fastjson2/support/spring6/data/redis/GenericFastJsonRedisSerializer.java