> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Haskey

# \$hasKey

The `$hasKey` operator checks if an object contains a specific key.

## Input

* An array containing an object/map and a string key name

## Output

* `true` if the object contains the specified key, `false` otherwise

## Examples

### Check If Object Has Key

```json theme={null}
{
  "$hasKey": [
    {
      "name": "Alice",
      "age": 25,
      "city": "New York"
    },
    "age"
  ]
}
```

Result: `true`

### Check If Object Does Not Have Key

```json theme={null}
{
  "$hasKey": [
    {
      "name": "Alice",
      "age": 25,
      "city": "New York"
    },
    "email"
  ]
}
```

Result: `false`

### From Field

```json theme={null}
{
  "$hasKey": [
    {
      "$input": "user_object"
    },
    "email"
  ]
}
```

Result: `true` if the user\_object field contains an "email" key, otherwise `false`
