Splits an array or object into chunks of the specified size.
Breaks a single list into several smaller lists of a fixed size. The items are taken in order and grouped together until each group reaches the size you choose; the final group holds whatever is left over and may be smaller. Use this to process data in manageable batches, for example sending products to an external system 50 at a time instead of all at once.
The five items are grouped into pairs, with the leftover item forming a final single-item chunk. With Preserve keys turned on, the items keep their original positions instead, so the later chunks would look like { "2": "C3", "3": "D4" } and { "4": "E5" }.
Was this page helpful?
⌘I
Assistant
Responses are generated using AI and may contain mistakes.