code: def to_json_serializable(obj):
      
      if isinstance(obj, Entity):
          return obj.to_json_dict()
  
      if isinstance(obj, dict):
          return {k: to_json_serializable(v) for k, v in obj.items()}
      elif isinstance(obj, (list, tuple)):
          return [to_json_serializable(v) for v in obj]
      elif isinstance(obj, datetime):
          return obj.strftime('%Y-%m-%d %H:%M:%S')
      elif isinstance(obj, date):
          return obj.strftime('%Y-%m-%d')
  
      return obj
docs: Transforms obj into a json serializable object.
  
      :param obj: entity or any json serializable object
  
      :return: serializable object