code: def body_as_json(self, encoding='UTF-8'):
          
          data_str = self.body_as_str(encoding=encoding)
          try:
              return json.loads(data_str)
          except Exception as e:
              raise TypeError("Event data is not compatible with JSON type: {}".format(e))
docs: The body of the event loaded as a JSON object is the data is compatible.
  
          :param encoding: The encoding to use for decoding message data.
           Default is 'UTF-8'
          :rtype: dict