---
title: CHUNK_ARRAY
url: https://www.tines.com/docs/formulas/functions/chunk-array/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# CHUNK_ARRAY

*[View on tines.com](https://www.tines.com/docs/formulas/functions/chunk-array/)*

Chunks an array into arrays with chunk_size elements. The last chunk may contain less than chunk_size elements.

**Categories:** Arrays

## Syntax

```
CHUNK_ARRAY(array, chunk_size)
```

## Examples

### Example 1

Input:

```json
{
  "my_action": {
    "message": [
      "north",
      "south",
      "east",
      "west"
    ]
  }
}
```

Formula:

```
CHUNK_ARRAY(my_action.message, 2)
```

Output:

```json
[
  [
    "north",
    "south"
  ],
  [
    "east",
    "west"
  ]
]
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "1",
  "agents": [
    {
      "disabled": false,
      "name": "CHUNK ARRAY",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "chunk_array": "=CHUNK_ARRAY(my_action.flat_array, 2)"
        }
      },
      "position": {
        "x": -6630,
        "y": -1260
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "flat_array": [
            "apple",
            "pear",
            "orange",
            "grapes"
          ]
        }
      },
      "position": {
        "x": -6630,
        "y": -1365
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
