Dictionary Operations

This function block provides an interface for various operations that can be performed on dictionaries. Users can create, update, remove, extend, retrieve, copy, parse, and stringify dictionary data.

πŸ“₯ Inputs

Dict This input accepts a dictionary object to perform operations on, depending on the selected method.

πŸ“€ Outputs


<h2 id="controls">πŸ•ΉοΈ Controls</h2>

`Select Method` A dropdown menu allowing users to choose the operation they want to perform on the dictionary. Options include:

- Create
- Update
- Remove
- Extend
- Get
- Copy
- Parse
- To String

`Info Text` Displays information and descriptions about the selected method, including input requirements and constraints.

<h2 id="features">🎨 Features</h2>

`Versatile Dictionary Operations` The block can perform a variety of dictionary operations, making it a central tool for data manipulation.

`Dynamic Socket Adjustments` The input and output sockets will update dynamically based on the selected method, ensuring that users have the correct inputs and outputs for their chosen action.

<h2 id="usage">πŸ“ Usage Instructions</h2>

1. **Select Operation**: Choose the desired dictionary operation from the `Select Method` dropdown.

2. **Connect Inputs**: Depending on the selected method, connect the necessary inputs to the `Dict` socket.

3. **Execute Operation**: Run the block to perform the selected dictionary operation.

4. **Retrieve Output**: Access the output socket to obtain the result of the operation.

<h2 id="evaluation">πŸ“Š Evaluation</h2>

The function block evaluates the selected operation and processes the input dictionary accordingly.

<h2 id="tips-and-tricks">πŸ’‘ Tips and Tricks</h2>

<details>

<summary>Using Create Method</summary>

When using the ``Create`` method, ensure both keys and values have the same length before executing to avoid errors.

</details>

<details>

<summary>Updating and Removing Keys</summary>

When updating or removing using the ``Update`` or ``Remove`` methods, check that the key exists in the dictionary before execution to prevent errors.

</details>

<details>

<summary>Parsing JSON to Dictionary</summary>

When using the ``Parse`` method, ensure that the input string is formatted correctly as JSON with double quotes, or it may throw an error.

</details>

<details>

<summary>Stringifying a Dictionary</summary>

Using the ``To String`` method allows you to convert a dictionary to JSON format, which can be useful for logging or transmitting dictionary data.

</details>

<h2 id="troubleshooting">πŸ› οΈ Troubleshooting</h2>

<details>

<summary>Expected Key Not Found</summary>

If you're trying to update or remove a key that doesn’t exist, ensure that you check for its presence in the dictionary beforehand to avoid unnecessary errors.

</details>

<details>

<summary>Paring Invalid JSON</summary>

When using the ``Parse`` method, if you encounter a JSON decoding error, double-check that your string uses double quotes and is correctly formatted.

</details>

Last updated

Was this helpful?