def default(self, obj):
        """Encode more types."""
        if isinstance(obj, UUID):
            return obj.hex
        elif isinstance(obj, datetime.datetime):
            return obj.isoformat()

        return super().default(obj)
def default ( self , obj ) : if isinstance ( obj , UUID ) : return obj . hex elif isinstance ( obj , datetime . datetime ) : return obj . isoformat ( ) return super ( ) . default ( obj )
Encode more types.