Ask AI
Skip to main content

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) and value (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
  • Result: A new variable named userProfileDetails will be created, containing a list like this:
    [
    \{"key": "firstName", "value": "Alice"\},
    \{"key": "lastName", "value": "Smith"\},
    \{"key": "email", "value": "[email protected]"\},
    \{"key": "age", "value": 30\}
    ]
    You can then easily loop through userProfileDetails to 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
  • Result: A new variable named productConfigLog will be created, containing a list like this:
    [
    \{"key": "productName", "value": "Laptop Pro"\},
    \{"key": "price", "value": 1200\},
    \{"key": "inStock", "value": true\},
    \{"key": "color", "value": "Silver"\}
    ]
    This list can then be used to write each configuration detail to a log file or send it to an analytics service.

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
  • Result: A new variable named submittedOrderFields will be created, containing a list like this:
    [
    \{"key": "orderId", "value": "ORD-001"\},
    \{"key": "customerName", "value": "Bob Johnson"\},
    \{"key": "totalAmount", "value": 250.75\},
    \{"key": "paymentMethod", "value": "Credit Card"\}
    ]
    You can then use this list to perform actions on each field, such as checking if totalAmount is a positive number or saving each key and value to a database table.