Update JSON icon

Update JSON

Update existing JSON data in the JSON Vault

Update JSON

AI-generated

Overview

This node updates existing JSON data stored in a global JSON Vault within an n8n workflow. It allows users to specify a key (including nested keys using dot notation) to update with new JSON data. The node supports either replacing the entire value at the key or deeply merging new data with existing objects. It can create the key if it does not exist, based on user preference. This node is useful for workflows that need to maintain and update shared JSON data dynamically, such as user settings, configuration data, or aggregated information across multiple workflow executions.

Use Case Examples

  1. Updating user profile data stored in a JSON Vault by merging new attributes without overwriting the entire profile.
  2. Replacing a configuration object in the JSON Vault with a new JSON object received from an API.
  3. Creating a new nested key in the JSON Vault if it does not exist and setting its value from previous node output.

Properties

Name Meaning
Key The key in the JSON Vault to update. Supports nested paths with dots (e.g., 'users.admin'). This determines where the JSON data will be updated.
JSON Data The JSON object or value to update at the specified key. Can be entered manually as a JSON string/object or taken from the previous node's output.
Merge Mode Determines how the new JSON data updates the existing value at the key. 'Replace' overwrites the entire value, while 'Deep Merge' merges the new data with the existing object (only applicable for objects).
Create if Not Exists Whether to create the key in the JSON Vault if it does not already exist.
Data Source Specifies where to get the JSON data from: manually entered or from the previous node's input.

Output

JSON

  • json
    • success - Indicates if the update operation was successful (true or false).
    • key - The key that was updated in the JSON Vault.
    • action - The action performed, always 'updated'.
    • existed - Boolean indicating if the key existed before the update.
    • vaultSize - The total number of keys currently stored in the JSON Vault.
    • error - Error message if the update operation failed.

Dependencies

  • Requires access to a global JSON Vault storage within the workflow's static data.

Troubleshooting

  • Error if the 'Key' parameter is empty or invalid format (only letters, numbers, dots, hyphens, and underscores allowed).
  • Error if the key does not exist in the vault and 'Create if Not Exists' is false.
  • Error if JSON data is invalid or cannot be parsed when entered manually.
  • Ensure the JSON Vault size does not exceed limits; otherwise, an error is thrown.

Discussion