def default(self, obj): if isinstance(obj, smallDuck): return { obj.__class__.__name__ : obj.__dict__ } return json.JSONEncoder.default(self, obj)