Refactor serialization API to use typed/named serializers.