Somehow my comment here was not stored. I also prefer the "duck typing" way here as I don't think it is a good idea to have external class dependencies in the library. Probably it would make sense to add a link to an example serializer