Skip to content

set

Assigns a value to a field, creating it if necessary.

field = expr
set field=expr...

Assigns a value to a field, creating it if necessary. If the field does not exist, it is appended to the end. If the field name is a path such as foo.bar.baz, records for foo and bar will be created if they do not exist yet.

Within assignments, the move keyword in front of a field causes a field to be removed from the input after evaluation.

from {a: 1, b: 2}
c = a + b
{a: 1, b: 2, c: 3}
from {a: 1, b: 2}
a = "Hello"
{a: "Hello", b: 2}
from {a: 1}
b = move a
{b: 1}

move