Get object entries
Function: Get object entries
This action helps you extract all the individual pieces of information (called 'key-value pairs') stored within a single 'Object' variable. It takes an Object and turns it into a list where each item in the list represents one piece of information from the original Object, showing both its name (key) and its content (value). This is useful when you need to process or display each piece of information from an object separately.
Input
- Object: The main object variable from which you want to extract all its contained information. This object should contain various named pieces of data.
- Type: Object
Output
- Result: The name of the variable where the action will store the list of key-value pairs. Each item in this list will be an object containing two properties:
key(the name of the piece of information) andvalue(its content).- Type: Array of Objects
Execution Flow
Real-Life Examples
Example 1: Displaying User Profile Details
Imagine you have an object containing a user's profile information and you want to display each detail on a profile page.
- Inputs:
- Object:
\{"firstName": "Alice", "lastName": "Smith", "email": "[email protected]", "age": 30\} - Result:
userProfileDetails
- Object:
- Result: A new variable named
userProfileDetailswill be created, containing a list like this:You can then easily loop through[
\{"key": "firstName", "value": "Alice"\},
\{"key": "lastName", "value": "Smith"\},
\{"key": "email", "value": "[email protected]"\},
\{"key": "age", "value": 30\}
]userProfileDetailsto display each item, for example, "First Name: Alice", "Last Name: Smith", etc.
Example 2: Logging Product Configuration
Suppose you have an object representing a product's configuration and you need to log all its properties for auditing or debugging.
- Inputs:
- Object:
\{"productName": "Laptop Pro", "price": 1200, "inStock": true, "color": "Silver"\} - Result:
productConfigLog
- Object:
- Result: A new variable named
productConfigLogwill be created, containing a list like this:This list can then be used to write each configuration detail to a log file or send it to an analytics service.[
\{"key": "productName", "value": "Laptop Pro"\},
\{"key": "price", "value": 1200\},
\{"key": "inStock", "value": true\},
\{"key": "color", "value": "Silver"\}
]
Example 3: Processing Form Submission Data
When a user submits a form, the data often comes as a single object. You might need to iterate through each submitted field to validate it or store it in a database.
- Inputs:
- Object:
\{"orderId": "ORD-001", "customerName": "Bob Johnson", "totalAmount": 250.75, "paymentMethod": "Credit Card"\} - Result:
submittedOrderFields
- Object:
- Result: A new variable named
submittedOrderFieldswill be created, containing a list like this:You can then use this list to perform actions on each field, such as checking if[
\{"key": "orderId", "value": "ORD-001"\},
\{"key": "customerName", "value": "Bob Johnson"\},
\{"key": "totalAmount", "value": 250.75\},
\{"key": "paymentMethod", "value": "Credit Card"\}
]totalAmountis a positive number or saving eachkeyandvalueto a database table.