> ## 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.

# Toboolean

# \$toBoolean

The `$toBoolean` operator converts a value to a boolean.

## Input

* A single value of any type

## Output

* The boolean representation of the input value

## Examples

### Convert Number to Boolean

```json theme={null}
{
  "$toBoolean": [
    1
  ]
}
```

Result: `true`

### Convert Zero to Boolean

```json theme={null}
{
  "$toBoolean": [
    0
  ]
}
```

Result: `false`

### Convert String to Boolean

```json theme={null}
{
  "$toBoolean": [
    "true"
  ]
}
```

Result: `true`

### From Field

```json theme={null}
{
  "$toBoolean": [
    {
      "$input": "value"
    }
  ]
}
```

Result: The boolean representation of the value field
