Skip to content

#using

Binds a path or value to a range variable so statements can modify it.

"#using(source as @variable) into 'name' | @variable": [ statements ]
Category Loops and scopingValid in Property name
Name Type Description
source path | value The node to copy and modify.
@variable variable The name statements operate on.

any — The modified copy.

source.json
{
"some": {
"integerArray": [ 1, 2, 6, 10 ],
"complexObject": { "some": { "path": 5 } }
}
}
transformer.json
{
"#using($.some as @x) into 'result'": [
"#removeAt(@x.integerArray)",
"#setAt(@x.complexObject.new.value, 3)",
"#setAt(@x.complexObject.some.path, 20)"
]
}
output.json
{
"result": {
"complexObject": { "new": { "value": 3 }, "some": { "path": 20 } }
}
}

Try it in the playground →

#setAt · #removeAt · #when