The copy
operator copies a value from one field to another.
Field | Default | Description |
---|---|---|
id |
copy |
A unique identifier for the operator. |
output |
Next in pipeline | The connected operator(s) that will receive all outbound entries. |
from |
required | The field from which the value should be copied. |
to |
required | The field to which the value should be copied. |
on_error |
send |
The behavior of the operator if it encounters an error. See on_error. |
if |
An expression that, when set, will be evaluated to determine whether this operator should be used for the given entry. This allows you to do easy conditional parsing without branching logic with routers. |
Copy a value from the body to resource
- type: copy
from: body.key
to: resource.newkey
Input Entry | Output Entry |
{
"resource": { },
"attributes": { },
"body": {
"key":"value"
}
} |
{
"resource": {
"newkey":"value"
},
"attributes": { },
"body": {
"key":"value"
}
} |
Copy a value from the body to attributes
- type: copy
from: body.key2
to: attributes.newkey
Input Entry | Output Entry |
{
"resource": { },
"attributes": { },
"body": {
"key1": "val1",
"key2": "val2"
}
} |
{
"resource": { },
"attributes": {
"newkey": "val2"
},
"body": {
"key3": "val1",
"key2": "val2"
}
} |
Copy a value from attributes to the body
- type: copy
from: attributes.key
to: body.newkey
Input Entry | Output Entry |
{
"resource": { },
"attributes": {
"key": "newval"
},
"body": {
"key1": "val1",
"key2": "val2"
}
} |
{
"resource": { },
"attributes": {
"key": "newval"
},
"body": {
"key3": "val1",
"key2": "val2",
"newkey": "newval"
}
} |
Copy a value within the body
- type: copy
from: body.obj.nested
to: body.newkey
Input Entry | Output Entry |
{
"resource": { },
"attributes": { },
"body": {
"obj": {
"nested":"nestedvalue"
}
}
} |
{
"resource": { },
"attributes": { },
"body": {
"obj": {
"nested":"nestedvalue"
},
"newkey":"nestedvalue"
}
} |