---
title: where
description: "Keep array items whose property exactly matches a value."
---

# where

Keep array items whose property exactly matches a value.

## Syntax

```knap
{{ value | where:("published", true) }}
{{ value | where:("status", "draft") }}
{{ value | where:("author.name", "Ada") }}
```

## Usage

- A quoted property path and comparison value are required. Dotted paths select nested own properties.
- Strings, numbers, booleans, and `null` are compared by type and value.
- Missing properties never match, including when the comparison value is `null`.
- Matching items retain their types and original order.

## Examples

### Boolean property

```json title="Data"
{
  "posts": [
    {
      "title": "One",
      "published": true
    },
    {
      "title": "Two",
      "published": false
    }
  ]
}
```

```knap title="Template"
{{ posts | where:("published", true) | map:"title" | join:", " }}
```

```md title="Output"
One
```

### Typed equality

```json title="Data"
{
  "items": [
    {
      "value": 1
    },
    {
      "value": "1"
    }
  ]
}
```

```knap title="Template"
{{ items | where:("value", "1") }}
```

```md title="Output"
[{"value":"1"}]
```

## Related filters

- [map](/filters/map)
- [sum](/filters/sum)
