> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/build/work-with-data/transform-data/expression-reference/boolean.md).

# Boolean

## *`Boolean`*.**`isEmpty()`** <a href="#booleanisempty" id="booleanisempty"></a>

**Description:** Returns `true` if the boolean is `false`, `null`, or `undefined`. Returns `false` if the boolean is `true`.

{% hint style="warning" %}
`isEmpty()` isn't a null check. On a boolean it treats `false` as empty, so `{{ $json.flag.isEmpty() }}` returns `true` for both a missing field and a field set to `false`. To test only for a missing value, compare directly, for example `{{ $json.flag === null }}`, or use the **exists** operator in the **If** node.
{% endhint %}

**Syntax:** *`Boolean`*.isEmpty()

**Returns:** Boolean

**Source:** Custom n8n functionality

**Examples:**

```javascript
// bool = true
bool.isEmpty() // => false
```

```javascript
// bool = false
bool.isEmpty() // => true
```

```javascript
// bool = null
bool.isEmpty() // => true
```

## *`Boolean`*.**`isNotEmpty()`** <a href="#booleanisnotempty" id="booleanisnotempty"></a>

**Description:** Returns `true` if the boolean is `true`. Returns `false` if the boolean is `false`, `null`, or `undefined`. This is the inverse of `isEmpty()`.

**Syntax:** *`Boolean`*.isNotEmpty()

**Returns:** Boolean

**Source:** Custom n8n functionality

**Examples:**

```javascript
// bool = true
bool.isNotEmpty() // => true
```

```javascript
// bool = false
bool.isNotEmpty() // => false
```

```javascript
// bool = null
bool.isNotEmpty() // => false
```

## *`Boolean`*.**`toNumber()`** <a href="#booleantonumber" id="booleantonumber"></a>

**Description:** Converts `true` to 1 and `false` to 0

**Syntax:** *`Boolean`*.toNumber()

**Returns:** Number

**Source:** Custom n8n functionality

**Examples:**

```javascript
true.toNumber() //=> 1
```

```javascript
false.toNumber() //=> 0
```

## *`Boolean`*.**`toString()`** <a href="#booleantostring" id="booleantostring"></a>

**Description:** Converts `true` to the string ‘true’ and `false` to the string ‘false’

**Syntax:** *`Boolean`*.toString()

**Returns:** String

**Source:** JavaScript function

**Examples:**

```javascript
// bool = true
bool.toString() //=> 'true'
```

```javascript
// bool = false
bool.toString() //=> 'false'
```
