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

# Tonumber

# \$toNumber

The `$toNumber` operator converts a value to a number.

## Input

* A single value of any type

## Output

* The numeric representation of the input value

## Examples

### Convert String to Number

```json theme={null}
{
  "$toNumber": [
    "123"
  ]
}
```

Result: `123`

### Convert Boolean to Number

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

Result: `1`

### Convert String with Decimal to Number

```json theme={null}
{
  "$toNumber": [
    "45.67"
  ]
}
```

Result: `45.67`

### From Field

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

Result: The numeric representation of the value field
