Overview
The "Compare Dictionaries" node compares two dictionaries (objects) and outputs the differences between them. It is useful in scenarios where you need to identify changes or discrepancies between two sets of key-value pairs, such as comparing configurations, data snapshots, or API responses.
Common use cases include:
- Detecting updates between two versions of a record.
- Validating changes in JSON objects before processing.
- Synchronizing data by identifying what has changed.
For example, if you have two JSON objects representing user profiles at different times, this node can highlight which fields have changed.
Properties
| Name | Meaning |
|---|---|
| Compare Mode | Method to provide dictionaries for comparison: - Use Input Connections: take dictionaries from the two input connections. - Use Manual Input: enter both dictionaries manually as JSON strings. |
| First Dictionary | The first dictionary to compare (JSON string). Visible only when using manual input mode. |
| Second Dictionary | The second dictionary to compare (JSON string). Visible only when using manual input mode. |
| Options | Collection of additional options: - Ignore Null Values: ignore keys with null values during comparison. - Ignore Empty Strings: ignore keys with empty string values during comparison. - Continue On Error: continue execution even if errors occur during comparison. |
Output
The node outputs a single JSON object containing only the keys that differ between the two dictionaries, with their values taken from the second dictionary.
- If a key exists in both dictionaries but has different values (considering the ignore options), it will appear in the output with the value from the second dictionary.
- Keys with null or empty string values can be ignored based on options.
- If no differences are found, the output will be an empty object
{}.
The output does not include binary data.
Example output JSON:
{
"TITLE": "Лид #2",
"STATUS": "Updated"
}
Dependencies
- No external services or APIs are required.
- The node relies on standard JSON parsing and comparison logic.
- Requires proper JSON format when using manual input mode.
- No special environment variables or credentials needed.
Troubleshooting
Error: "Necessary data from both input connections is missing"
Occurs when using input connections mode but one or both inputs are empty. Ensure both inputs provide valid JSON objects.Error: "Invalid JSON format in one of the dictionaries"
Happens when manual input contains malformed JSON. Validate JSON syntax before running.Empty output despite expected differences
Check if "Ignore Null Values" or "Ignore Empty Strings" options are enabled, which may filter out some differences.Continue On Error option
When enabled, the node returns an empty object instead of failing on errors, allowing workflows to proceed.