For the complete documentation index, see llms.txt. This page is also available as Markdown.

each

The each function iterates through each item of an array, similar to a foreach loop.

The current item is accessible via the $this variable. The current index is accessible via $key.

The return values from each are ignored — it is useful when you want to modify values in-place.

Most commonly used with:

Syntax

<array>.each(expression)

Examples

Modifying data in-place

$ echo '[1, 2, 3]' | dasel -i json 'each($this = $this + 1)'
[
    2,
    3,
    4
]

Uppercase all names in a file

Combined with search — update deeply nested values

This finds all objects with a status field anywhere in the document and sets them to "active".

Last updated