Allow serializers to handle dicts as well as objects.  Fixes #447.