more general de-/serializer