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

# JSON Length

export const type_0 = "$jsonLength"

## Definition

```php theme={null}
Filter::field('options->languages', [FilterType::JSON_LENGTH]);
```

<Note>
  [See JSON Path Wildcards](/v2/digging-deeper/json-path-wildcards)
</Note>

## Array/Object Structure

<ParamField body="type" type="string" required>
  <code>
    {type_0}
  </code>
</ParamField>

<ParamField body="target" type="string" required />

<ParamField body="operator" type="string,['=', '<', '<=', '>', '>=']" required />

<ParamField body="value" type="int" required />

## Example

```php theme={null}
$filter = [
    'type'     => '$jsonLength',
    'target'   => 'options->languages',
    'operator' => '>=',
    'value'    => 2,
];
```

```php theme={null}
$sql = User::filter([$filter])->toRawSql();
```

### SQL

```sql theme={null}
select * from "users"
where json_length("users"."options", '$."languages"') >= 2
```

## Modifiers

None available.
