Ask AI
Skip to main content

Get value from object

Function: Get value from object

This action allows you to extract specific pieces of information from a larger collection of data, often referred to as an "object" or "map." Think of it like finding a specific item in a structured list or a detailed form. You tell the system which object to look into and provide a "Jsonpath" ? a special instruction that points directly to the data you want to retrieve.

Input,

  • Object: The collection of data (like a record, a form submission, or a list of settings) from which you want to extract a value. This is typically a set of key-value pairs.
  • Jsonpath: A text instruction that describes the exact location of the value you want to retrieve within the "Object." For example, if your object has a field called "user" which contains another field called "email," a Jsonpath might look like $.user.email.

Output,

  • Result: The specific value found at the location you specified with the "Jsonpath." This value can be text, a number, a date, a list, or even another object, depending on what the Jsonpath points to.

Execution Flow,

Real-Life Examples,

Example 1: Extracting a User's Email from a Profile

Imagine you have a user profile object and you need to get just their email address.

  • Inputs:
    • Object:
      \{
      "id": "user123",
      "name": "Alice Smith",
      "contact": \{
      "email": "[email protected]",
      "phone": "555-1234"
      \},
      "status": "active"
      \}
    • Jsonpath: $.contact.email
  • Result: The action will return [email protected].

Example 2: Getting the Second Item from a List of Products

Suppose you have an object representing an order, which contains a list of products. You want to retrieve the name of the second product in that list.

  • Inputs:
    • Object:
      \{
      "orderId": "ORD-001",
      "customer": "Bob Johnson",
      "products": [
      \{"name": "Laptop", "price": 1200\},
      \{"name": "Mouse", "price": 25\},
      \{"name": "Keyboard", "price": 75\}
      ],
      "total": 1300
      \}
    • Jsonpath: $.products[1].name
  • Result: The action will return Mouse. (Note: Lists often start counting from 0, so [1] refers to the second item).

Example 3: Checking if a Feature is Enabled in Application Settings

You have an object containing various application settings, and you need to know if a specific feature is turned on.

  • Inputs:
    • Object:
      \{
      "appName": "My CRM",
      "version": "2.1",
      "settings": \{
      "notifications": \{
      "email": true,
      "sms": false
      \},
      "featureFlags": \{
      "darkMode": true,
      "analytics": true,
      "betaFeatures": false
      \}
      \}
      \}
    • Jsonpath: $.settings.featureFlags.betaFeatures
  • Result: The action will return false.