add-value-to-dictionary adaptor is used to add a key-value pair to an existing dictionary, or to a new dictionary if the dictionary input is not specified.
By default, the adaptor will update the value if the key is already existing in the input dictionary. This can be changed by setting overwrite input to False.
dictionary
Type: dictionary
Required: No
The dictionary to which the value will be added. If unspecified, the value will be added to a new dictionary.
key
Type: text
Required: Yes
The key to be added to the dictionary.
value
Type: text
Required: Yes
The value to be added to the dictionary.
overwrite
Type: boolean
Required: No
Whether to overwrite the value if the specified key already exists in the dictionary. If unspecified, defaults to True.
dictionary
Type: dictionary
A dictionary containing the added value.
Example 1: Default behaviour.
dictionary:
key: US value: United States
dictionary:
-> Added a new key-value pair { US: "United States" } to an existing dictionary.
Example 2: Adding a key-value pair to a new dictionary.
key: GB
value: United Kingdom
dictionary:
-> Added a key-value pair { GB: "United Kingdom" } to a new dictionary.
Example 3: Updating an existing key in a dictionary.
dictionary:
key: TR
value: Turkiye
dictionary:
-> Updated an existing dictionary with the key-value pair { TR: "Turkiye" }.
Represent associative data where there is a clear relationship between keys and values, such as mapping country codes to country names.
Facilitate language translation by using key-value pairs where keys represent phrases or terms in one language, and values represent their translations in another language.