code: def alchemyencoder(obj):
      
      if isinstance(obj, datetime.date):
          return obj.isoformat()
      elif isinstance(obj, decimal.Decimal):
          return float(obj)
docs: JSON encoder function for SQLAlchemy special classes.