Use a CustomEncoder to handle timedelta