code: def default(self, obj, **kwargs):
          
          if isinstance(obj, datetime.datetime):
              return time.mktime(obj.timetuple())
  
          if isinstance(obj, Timestamp):
              return obj.time
  
          if isinstance(obj, ObjectId):
              return obj.__str__()
  
          return JSONEncoder.default(self, obj)
docs: Handles the adapting of special types from mongo