two-way serialization