Dictionary Operations
This function block provides a flexible interface to create, modify, query, and convert dictionary-like data during your scenario. Select a method from the control and the block will adapt its inputs and outputs to match the chosen operation.
π₯ Inputs
The available inputs depend on the selected method. The block dynamically changes sockets when you pick a method. Common input names you may see:
Dictβ Dictionary data to operate on (when required)Keysβ Single key (string) or list of keys for creationValuesβ Single value or list of values for creationInput Dictβ Source dictionary for update/remove/extend/get/copy operationsKeyβ Key string used for update/remove/get operationsValueβ Value used for update operationNew Dictβ Dictionary to merge into an existing one (extend)Textβ JSON text to parse (parse)Dict(for conversion) β Dictionary to convert to a text string
π€ Outputs
The outputs also depend on the selected method. Typical outputs include:
Dictβ Resulting dictionary after create/update/remove/extend/copy operationsTextβ JSON string result when using conversion to string or after parsing
When a single-key get is used, the output may return the requested value directly.
πΉοΈ Controls
Select Method Choose the desired dictionary operation. Available methods:
createupdateremoveextendgetcopyparseto_string
Info A contextual text area that displays help and usage hints for the currently selected method.
Note: changing Select Method will immediately update the block sockets to match the chosen operation.
π¨ Features
Dynamic sockets: inputs and outputs update automatically based on the chosen method so you only see relevant fields.
Quick JSON handling: parse JSON text into a dictionary and convert dictionaries to JSON strings with dedicated methods.
Merge and edit support: update single keys, remove keys, or extend an existing dictionary with another dictionary.
Copy support: create safe copies to avoid unintentional changes downstream.
Inline help: method-specific guidance is shown in the info area to reduce guesswork.
βοΈ Running mechanism
Select a method with
Select Methodthen connect the sockets that appear.When the scenario runs, the block performs the selected operation on the provided inputs and outputs the resulting data on the matching output sockets.
If inputs are invalid for the chosen operation (for example mismatched list lengths on creation, a missing key on get/remove, or an invalid JSON string on parse), the block will report an error message to help you fix the configuration.
π Usage instructions
Add the block and click
Select Methodto pick the appropriate operation.Connect sources to the sockets that appear (for example connect
KeysandValueswhen usingcreate).Use the
Infoarea for quick examples and notes specific to the selected method.Run the scenario and examine the outputs on the matching sockets.
π‘ Tips and Tricks
Persisting values: combine with
Data MemoryorData Write Local/Data Write Globalto keep dictionaries accessible across your scenario or between runs.Debugging: use
Debug Inputto inspect dictionary content during development.JSON flows: pair
parsewith aString Input(for manual JSON) or a text-producing block, then use the resulting dictionary downstream. Useto_stringbefore saving or publishing.Save/export: after
to_string, send the text toCSV ExportorFile/Folder Operationsif you need to store results.Conditional use: check for missing keys using
Is Noneafter agetoperation to avoid errors in later blocks.Merging updates: to build up a configuration gradually, use
extendtogether with periodicData Read Local/Data Write Localto keep a master dictionary.String handling: use
String MergeorFind Substringto construct or validate keys/values before passing them to update/create operations.
π οΈ Troubleshooting
Mismatched lists on creation
Cause:
KeysandValueswere provided as lists of different lengths.Fix: Make sure list lengths match or provide single key/value pairs.
Key not found on get/remove
Cause: Requested
Keydoes not exist in the providedInput Dict.Fix: Confirm keys using a debug display or use a safe check (e.g., verify existence before calling get/remove).
Invalid JSON when using parse
Cause: The provided
Textis not valid JSON (double quotes required for keys/strings).Fix: Validate your JSON text (use
String Inputor copy from a JSON-valid source). TheInfoarea shows an example format.
Unexpected shared changes
Cause: Downstream changes to a dictionary reference affect other blocks.
Fix: Use
copyor combine withData Memoryto control whether you are working on a copy or the original.
If you need to visualize or inspect intermediate images or values while working with dictionary-driven logic, consider connecting appropriate visual or export blocks (for example Show Image for image outputs or CSV Export for logged results).
Last updated
Was this helpful?