Serialize elements from a vector