Skip to main content

Set Value

Sets or updates a key-value pair in a JSON object.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Payload - JSON object in which to set or update a key-value pair.
  • Key - The key of the value to set or update in the JSON object.
  • Value - The value to set for the specified key.

Options

  • Escape - Whether to escape dots in the key name (useful for nested keys with dots).

Outputs

  • Payload - Modified JSON object with the specified key-value pair set or updated.

How It Works

The Set Value node sets or updates a key-value pair in a JSON object. When executed, the node:

  1. Receives a JSON object through the Payload input
  2. Receives a key name through the Key input
  3. Receives a value through the Value input
  4. Optionally escapes dots in the key name if the Escape option is enabled
  5. Sets or updates the specified key-value pair in the JSON object
  6. Outputs the modified JSON object through the Payload output

Requirements

  • Valid JSON object as input
  • Valid key name to set or update
  • Valid value to set

Error Handling

The node will return specific errors in the following cases:

  • Invalid JSON object in the Payload input
  • Invalid key name in the Key input
  • Invalid value in the Value input

Usage Notes

  • This node is useful for adding new data to JSON objects or updating existing values
  • Works with nested JSON objects using dot notation (e.g., "user.name")
  • The Escape option is useful when key names contain dots that should be treated as literal characters
  • Can set any type of value including strings, numbers, objects, arrays, and booleans
  • If the key already exists, its value will be updated; if not, a new key-value pair will be added
  • Works with any valid JSON structure
  • Useful for data manipulation and transformation workflows
  • Can be combined with other JSON nodes to build complex data processing pipelines
  • Supports deep nesting with multiple levels of dot notation (e.g., "user.profile.name")
  • The output object maintains the same structure as the input with the specified key-value pair added or updated