Use io.BytesIO for collection serialization