JSON TransformObject
set
Set a value at a dot-separated path
set
Sets value at a nested location described by path. Intermediate objects are created on the fly when missing.
Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | — | Dot-separated path (e.g., "user.profile.name"). |
value | any | Yes | — | Value to write. |
Example
Input
{ "user": { "id": 1 } }Operation
{
"type": "set",
"options": {
"path": "user.profile.name",
"value": "Ada"
}
}Output
{
"user": {
"id": 1,
"profile": { "name": "Ada" }
}
}In a Circuit Step
{
"name": "set_user_profile_name",
"description": "Write a value at user.profile.name, creating intermediate objects",
"function": "circuit.core.transform.json",
"input": {
"source": "${{ record }}",
"operations": [
{
"type": "set",
"options": {
"path": "user.profile.name",
"value": "${{ input.display_name }}"
}
}
]
},
"outputs": [
{
"name": "patched_record",
"description": "Record with display name set on user.profile",
"value": "${{ set_user_profile_name.output.transformed_result }}"
}
]
}Notes & gotchas
- Errors with
set: expected objectif the input is not an object. - Missing intermediate keys are created as empty objects.
- Existing scalar values along the path are overwritten with objects to make room —
set("a.b", 1)on{ "a": "string" }will replace"string"with{ "b": 1 }. Be careful. pathdoes not support array indices — only object keys. To mutate an array element, usereplaceAtormapon the parent.valueis not selector-evaluated bysetitself; rely on outer selector resolution if the value contains${{ ... }}.