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

# Array Tools

> Filter, sort, group, chunk, and transform arrays.

The Array Tools connector provides operations for working with arrays: filtering, sorting, grouping, deduplication, set operations, and more.

> [!NOTE]
>
> No connection required; this utility connector works out of the box.

## Tools

> [accordion] filter: Filter by condition
>
> **array** `any[]` *required*
>
> Array to filter.
>
> **key** `string`
>
> Object property to filter on (for arrays of objects).
>
> **operator** `string` *required*
>
> Operator: `equals`, `not_equals`, `contains`, `gt`, `gte`, `lt`, `lte`, `exists`, or `not_exists`.
>
> **value** `any`
>
> Value to compare.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "name": "Alice", "age": 30 },
>     { "name": "Bob", "age": 25 },
>     { "name": "Carol", "age": 35 }
>   ],
>   "key": "age",
>   "operator": "gte",
>   "value": 30
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [
>     { "name": "Alice", "age": 30 },
>     { "name": "Carol", "age": 35 }
>   ],
>   "count": 2
> }
> ```

> [accordion] sort: Sort array
>
> **array** `any[]` *required*
>
> Array to sort.
>
> **key** `string`
>
> Property to sort by (for arrays of objects).
>
> **order** `string` (default: asc)
>
> Sort order: `asc` or `desc`.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "name": "Carol", "score": 88 },
>     { "name": "Alice", "score": 95 },
>     { "name": "Bob", "score": 72 }
>   ],
>   "key": "score",
>   "order": "desc"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [
>     { "name": "Alice", "score": 95 },
>     { "name": "Carol", "score": 88 },
>     { "name": "Bob", "score": 72 }
>   ],
>   "count": 3
> }
> ```

> [accordion] unique: Remove duplicates
>
> **array** `any[]` *required*
>
> Array to deduplicate.
>
> **key** `string`
>
> Property to check for uniqueness (for arrays of objects).
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "city": "Portland", "state": "OR" },
>     { "city": "Seattle", "state": "WA" },
>     { "city": "Portland", "state": "ME" }
>   ],
>   "key": "city"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [
>     { "city": "Portland", "state": "OR" },
>     { "city": "Seattle", "state": "WA" }
>   ],
>   "count": 2
> }
> ```

> [accordion] find: Find first match
>
> **array** `any[]` *required*
>
> Array to search.
>
> **key** `string` *required*
>
> Property to match on.
>
> **value** `any` *required*
>
> Value to find.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "id": 1, "name": "Alice" },
>     { "id": 2, "name": "Bob" },
>     { "id": 3, "name": "Carol" }
>   ],
>   "key": "id",
>   "value": 2
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "item": { "id": 2, "name": "Bob" }
> }
> ```

> [accordion] flatten: Flatten nested arrays
>
> **array** `any[]` *required*
>
> Array to flatten.
>
> **depth** `number`
>
> Depth to flatten (all levels if omitted).
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [1, [2, 3], [4, [5, 6]]],
>   "depth": 1
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [1, 2, 3, 4, [5, 6]],
>   "count": 5
> }
> ```

> [accordion] chunk: Split into chunks
>
> **array** `any[]` *required*
>
> Array to chunk.
>
> **size** `number` *required*
>
> Chunk size (minimum 1).
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": ["a", "b", "c", "d", "e"],
>   "size": 2
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [["a", "b"], ["c", "d"], ["e"]],
>   "count": 3
> }
> ```

> [accordion] first: Get first N elements
>
> **array** `any[]` *required*
>
> Source array.
>
> **count** `number` (default: 1)
>
> Number of elements to return.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [10, 20, 30, 40, 50],
>   "count": 3
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [10, 20, 30],
>   "count": 3
> }
> ```

> [accordion] last: Get last N elements
>
> **array** `any[]` *required*
>
> Source array.
>
> **count** `number` (default: 1)
>
> Number of elements to return.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [10, 20, 30, 40, 50],
>   "count": 2
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [40, 50],
>   "count": 2
> }
> ```

> [accordion] group-by: Group by property
>
> **array** `any[]` *required*
>
> Array to group.
>
> **key** `string` *required*
>
> Property to group by.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "name": "Alice", "department": "Engineering" },
>     { "name": "Bob", "department": "Sales" },
>     { "name": "Carol", "department": "Engineering" },
>     { "name": "Dave", "department": "Sales" }
>   ],
>   "key": "department"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "entries": {
>     "Engineering": [
>       { "name": "Alice", "department": "Engineering" },
>       { "name": "Carol", "department": "Engineering" }
>     ],
>     "Sales": [
>       { "name": "Bob", "department": "Sales" },
>       { "name": "Dave", "department": "Sales" }
>     ]
>   },
>   "count": 2
> }
> ```

> [accordion] pluck: Extract property values
>
> Extract a single property from each object in the array.
>
> **array** `any[]` *required*
>
> Array of objects.
>
> **key** `string` *required*
>
> Property to extract.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [
>     { "id": 1, "name": "Alice" },
>     { "id": 2, "name": "Bob" },
>     { "id": 3, "name": "Carol" }
>   ],
>   "key": "name"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": ["Alice", "Bob", "Carol"],
>   "count": 3
> }
> ```

> [accordion] reverse: Reverse order
>
> **array** `any[]` *required*
>
> Array to reverse.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [1, 2, 3, 4, 5]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [5, 4, 3, 2, 1],
>   "count": 5
> }
> ```

> [accordion] shuffle: Randomly shuffle
>
> **array** `any[]` *required*
>
> Array to shuffle.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [1, 2, 3, 4, 5]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [3, 5, 1, 4, 2],
>   "count": 5
> }
> ```

> [accordion] compact: Remove falsy values
>
> Removes `null`, `undefined`, `false`, `0`, `""`, and `NaN`.
>
> **array** `any[]` *required*
>
> Array to compact.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [0, 1, false, 2, "", 3, null, 4]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [1, 2, 3, 4],
>   "count": 4
> }
> ```

> [accordion] intersection: Common elements
>
> Get elements that exist in all provided arrays.
>
> **arrays** `any[][]` *required*
>
> Arrays to intersect.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "arrays": [
>     [1, 2, 3, 4],
>     [2, 4, 6, 8],
>     [2, 3, 4, 5]
>   ]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [2, 4],
>   "count": 2
> }
> ```

> [accordion] difference: Unique elements
>
> Get elements in the first array that don't exist in the second.
>
> **array** `any[]` *required*
>
> Primary array.
>
> **exclude** `any[]` *required*
>
> Values to exclude.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": [1, 2, 3, 4, 5],
>   "exclude": [2, 4, 6]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [1, 3, 5],
>   "count": 3
> }
> ```

> [accordion] union: Merge unique values
>
> Get unique values across all arrays.
>
> **arrays** `any[][]` *required*
>
> Arrays to union.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "arrays": [
>     [1, 2, 3],
>     [2, 3, 4],
>     [3, 4, 5]
>   ]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": [1, 2, 3, 4, 5],
>   "count": 5
> }
> ```

> [accordion] length: Get array length
>
> **array** `any[]` *required*
>
> Array to measure.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": ["apple", "banana", "cherry"]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "result": 3
> }
> ```

> [accordion] slice: Extract portion
>
> **array** `any[]` *required*
>
> Source array.
>
> **start** `number` (default: 0)
>
> Start index.
>
> **end** `number`
>
> End index (exclusive).
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": ["a", "b", "c", "d", "e"],
>   "start": 1,
>   "end": 4
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "items": ["b", "c", "d"],
>   "count": 3
> }
> ```

> [accordion] join: Join to string
>
> **array** `any[]` *required*
>
> Array to join.
>
> **separator** `string` (default: ,)
>
> Separator between elements.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "array": ["alice", "bob", "carol"],
>   "separator": " | "
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "result": "alice | bob | carol"
> }
> ```

> [card] [Try this free for 14 days](https://preview.condotta.ai/signup)
>
> Start a 14-day trial on Band 1. At day 14, choose your band, or stop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.