Skip to main content

List: Chunk

Split an input list into a list of fixed-size sub-lists. Useful for batching records before pushing to an API that accepts N items per call. The final chunk may be smaller than Size if the input length isn't a multiple of it.

Example
Size: 2
Input: [1, 2, 3, 4, 5]
Output: [[1, 2], [3, 4], [5]]

Parameters

SizeREQUIRED

Number of elements per chunk. Must be ≥ 1; defaults to 1 (each element becomes its own singleton list). 0 is rejected at runtime.

Input

ArrayREQUIRED

List to split (Array or JSON array).

Output

Result
A list of sub-lists.