def default(self, o):  # pylint: disable=method-hidden
        """Support more object types."""
        if isinstance(o, set):
            return list(sorted(o))
        elif hasattr(o, 'as_dict'):
            return o.as_dict()
        else:
            return super(JSONEncoder, self).default(o)
Support more object types.