serialize data before sending to redis