# File lib/openid_connect/connect_object.rb, line 29
    def as_json(options = {})
      options ||= {} # options can be nil when to_json is called without options
      validate! unless options[:skip_validation]
      all_attributes.inject({}) do |hash, _attr_|
        value = self.send(_attr_)
        hash.merge! _attr_ => case value
        when ConnectObject
          value.as_json options
        else
          value
        end
      end.delete_if do |key, value|
        value.nil?
      end
    end