Extract Key
The Extract Key component allows you to pull specific information from your data objects. You provide the source data and specify a key, and the component finds that key within the data, returning the associated value. It works with single items or lists, making it easy to extract details for processing in later steps of your workflow.
How it Works
When you connect this component, you provide your data and the name of the key you want to find. The component checks if you provided a single item or a list of items.
- If you provide a single Data object, it looks inside for the key and extracts the value.
- If you provide a list of Data objects, it goes through each item, extracts the value for the specified key, and returns a list of results.
If the key is found, the component hands back the value in a format ready for the next steps. If the key is missing or the data format is incorrect, the component provides a helpful error message instead of breaking your workflow.
Inputs
- Data Input: The Data object or list of Data objects to extract the key from.
- Key to Extract: The key in the Data object(s) to extract. You can type the key name manually or use drag-and-drop to insert variables dynamically from other parts of your workflow.
Outputs
- Extracted Data: Returns the extracted value wrapped in a Data object. If you provided a list, this output will also be a list of Data objects. If the key is not found or the input is invalid, the output will include an error field describing the issue.
Output Data Example (JSON)
json { “my_key”: “extracted_value” }
Connectivity
This component acts as a bridge between raw data and specific usage. Connect the output of components that generate Data (like a database query, file reader, or API response) to the Data Input port. Once extracted, you can connect the Extracted Data to any component that needs to use that specific value, such as an AI model to generate a response, a filter to check conditions, or a storage component to save the result.
Usage Example
Imagine you have a list of user records from a CRM system. You need the email address for each user to send a notification.
- Connect the output of your CRM component to the Data Input of the Extract Key component.
- In the Key to Extract field, enter
"email"(or drag the variable representing the email key). - The Extracted Data output will now contain a list of email addresses.
- Connect this output to an Email Sender component to distribute notifications.
Important Notes
⚠️ Key Not Found Handling 🟢 If the specified key does not exist in a Data object, the component returns a Data object with an “error” field describing the issue instead of the extracted value.
⚠️ Ignored Non‑Data Items 🟡 When providing a list of items, only elements that are Data objects will be processed. Other types are silently skipped, which may leave some list entries without an output.
📋 Provide Data Objects 🟢 The component expects the first input to be a Data object or a list of Data objects; passing other types will result in an error output.
📋 Key Must Be a String 🟢 The second input, the key to extract, must be a string. Leaving it blank or passing a non‑string value will cause extraction to fail.
💡 Use Exact, Case‑Sensitive Keys 🟢 The key lookup is case‑sensitive. Always double‑check the key spelling to avoid missing data or triggering errors.
💡 Check for Error Fields in Output 🟢 After extraction, inspect the returned Data object for an “error” field to handle cases where the key was absent or the input was invalid.
ℹ️ List Input Produces List Output 🟢 When a list of Data objects is supplied, the component returns a list of Data objects, each containing only the extracted key and value.
ℹ️ Missing Keys Omit Data from List 🟢 If a Data object in a list lacks the specified key, it is omitted from the result list rather than producing an error entry.
Tips and Best Practices
- Use the drag-and-drop feature on the Key to Extract field to easily reuse variables from your workflow instead of typing them manually.
- Preview your data before extracting to confirm the exact key names and structure used in your objects.
- Always check for error fields in the output to ensure your downstream components can handle missing data gracefully.
- When working with lists, be aware that items missing the key will be removed from the result, so verify your list contains all expected items.
Security Considerations
This component processes data locally within the workflow. Ensure that sensitive keys are not inadvertently exposed in logs or error messages if your system records them. Always verify the source of data inputs to prevent processing untrusted data.