def as_json
      # Build the payload's exception event
      payload_event = {
        app: {
          version: app_version,
          releaseStage: release_stage,
          type: app_type
        },
        context: context,
        device: {
          hostname: hostname
        },
        exceptions: exceptions,
        groupingHash: grouping_hash,
        session: session,
        severity: severity,
        severityReason: severity_reason,
        unhandled: @unhandled,
        user: user
      }

      # cleanup character encodings
      payload_event = Bugsnag::Cleaner.clean_object_encoding(payload_event)

      # filter out sensitive values in (and cleanup encodings) metaData
      filter_cleaner = Bugsnag::Cleaner.new(configuration.meta_data_filters)
      payload_event[:metaData] = filter_cleaner.clean_object(meta_data)
      payload_event[:breadcrumbs] = breadcrumbs.map do |breadcrumb|
        breadcrumb_hash = breadcrumb.to_h
        breadcrumb_hash[:metaData] = filter_cleaner.clean_object(breadcrumb_hash[:metaData])
        breadcrumb_hash
      end

      payload_event.reject! {|k,v| v.nil? }

      # return the payload hash
      {
        :apiKey => api_key,
        :notifier => {
          :name => NOTIFIER_NAME,
          :version => NOTIFIER_VERSION,
          :url => NOTIFIER_URL
        },
        :events => [payload_event]
      }
    end
def as_json
      # Build the payload's exception event
      payload_event = {
        app: {
          version: app_version,
          releaseStage: release_stage,
          type: app_type
        },
        context: context,
        device: {
          hostname: hostname
        },
        exceptions: exceptions,
        groupingHash: grouping_hash,
        session: session,
        severity: severity,
        severityReason: severity_reason,
        unhandled: @unhandled,
        user: user
      }

      # cleanup character encodings
      payload_event = Bugsnag::Cleaner.clean_object_encoding(payload_event)

      # filter out sensitive values in (and cleanup encodings) metaData
      filter_cleaner = Bugsnag::Cleaner.new(configuration.meta_data_filters)
      payload_event[:metaData] = filter_cleaner.clean_object(meta_data)
      payload_event[:breadcrumbs] = breadcrumbs.map do |breadcrumb|
        breadcrumb_hash = breadcrumb.to_h
        breadcrumb_hash[:metaData] = filter_cleaner.clean_object(breadcrumb_hash[:metaData])
        breadcrumb_hash
      end

      payload_event.reject! {|k,v| v.nil? }

      # return the payload hash
      {
        :apiKey => api_key,
        :notifier => {
          :name => NOTIFIER_NAME,
          :version => NOTIFIER_VERSION,
          :url => NOTIFIER_URL
        },
        :events => [payload_event]
      }
    end
Builds and returns the exception payload for this notification.