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