document serialization