Simplified polymorphic (de)serialization.