Jump to a Section
  • Clear Empty

    Removes keys with no values associated (e.g. null, “”, {}) from an object. Similar to the Object - Filter function but with the added ability of choosing whether or not the filtering is recursive.

    Input Fields

    • object:  the object you want to operate on
    • recursive: indicates how to handle objects that have sub-objects (see example below)
      • when false: the object is cleared of any keys that have empty values at the top level only
      • when true: the object is cleared of any empty keys, at any level

    Output Fields

    • output: your input object without the empty keys

    Examples

    If the input object is {"Name":"Emily", "Age":"", "Settings": {"test":{ }, "test2":"value2"}}
    If recursive is false, then output is {"Name":"Emily", "Settings":{"test":{ },"test2":"value2"}}
    If recursive is true, then output is {"Name":"Emily", "Settings":{"test2":"value2"}}

  • Construct

    Creates a new object based on a set of user-defined inputs.

    Input Fields

    • (user created fields): Create one input for each key you want to create in the output object. The input names become the key names in the object that gets created. Each input can be set to any type, including object or list.

    Output Fields

    • output:  The newly-constructed object

    Examples

    Let’s say we want to create an object that represents a customer. This object might need 4 keys:  ”First name”, “Last name”, “Age”, and “Loyalty?”. We would create inputs for each key name, then set the input types:  the name fields default to Text which is fine, but “Age” should be set to Number and “Loyalty?” - whether they are a member of our loyalty plan - should be set to True/False.  This would give you something like this:

    screen-shot-2016-09-30-at-2-56-25-pm

    Then drag in fields to complete the card.  At runtime, supposing the Flow is executing on customer Jane Smith, age 29, who is a loyalty member, you’d get an output object that looks like this:

    { 
      "First name": "Jane",
      "Last name": "Smith",
      "Age": 29,
      "Loyalty?": true
    }

    You can build any object using this function.  You can set the inputs to any type, including lists. As an advanced usage, if you want to define one of the keys as an object and you also want to construct that object at runtime, you can use two object.constructs - define the inner object first, then define the second object, setting one of the keys to type object. Finally, drag the output of the first card into the object key in the second card.

  • Filter

    The Filter card will remove keys with no values associated (e.g. null, “”, {}) from an object. If the object may contain other objects, use the Clear Empty card instead.

    Input Fields

    • object:  the object you want to operate on

    Output Fields

    • output: your input object without empty keys

    Examples

    Input object:  {“Name”:“Emily”, “Age”:“”, “Settings”: {“test”:{ }, “test2”:“value2”}}
    Output object:  {“Name”:“Emily”, “Settings”:{“test”:{ },“test2”:“value2”}}

    If you want to remove empty keys from sub-objects, use the Clear Empty function instead.

  • For Each

    Iterates through an object key-by-key using a child Flow. For each key in the input object, the child Flow is called with the key name and value for that key - you can select those using the dropdown in the designer after selecting a child Flow using the Choose Flow button.

    The child Flow will process each key/value pair together with any constants passed in to the child Flow. ForEach does not create an output, it simply performs the actions in the child Flow. If you need output values, consider Map to List or Map.

    Input Fields

    • object (required): the object to process
    • flow (required): the child Flow to process each key/value pair
    • (dynamically generated):  the inputs defined by the child Flow - use the dropdown to specify which input gets the key and which gets the value
    • concurrency: how many keys to process in parallel

    Output Fields

    • (none)
  • Get

    Reads the value stored in an object at a given path.  For example, if the object is:  { "a":"one", "b":"two", "c": 17 } then specifying a path of b will retrieve the text two.  To get more than one value at a time from an object, use Get Multiple instead.

    You can retrieve values from nested objects by using a dot to separate the key names, i.e. if the object is { "a": { "b": "this", "c":"that" } }then a path of a.c will retrieve the value that. If there’s a list in the path, you can use the index number in the path, i.e. if the object is {"a":[{"b":"first"},{"b":"second"},{"b":"third"}]} then a path of a.2.b will retrieve the value third.

    Important note:  you must define the type of the output to match the actual type of the value at that path.  If you specify a different type than the actual value, the Flow is likely to fail at runtime because the engine expects all types to be defined correctly when the Flow is designed.  For example, if you retrieve path c from object { "a":"one", "b":"two", "c": 17 } and don’t change the type of output to be number, then you may encounter runtime errors.

    Input Fields

    • object:  the object containing the desired key
    • path:  the key or path that identifies the desired value

    Output Fields

    • output: the value at the specified path
  • Get Multiple

    Picks several values from an object at once. Similar to Get, the Get Multiple card allows you to access values within an object by providing multiple keys and/or paths to values in an object. 

    Input Fields

    • object (required): the object or list of objects you want to pick values from

    Output Fields

    Add an output field for each value you want to get from the provided object. Each field must be named as the single key name or path you want to get the value of, and must be an identical match to the key names used in the object. Additionally, you must set each output field type to match the type of the return value.

    Example

    If the input object is:

    {"product":"a123", "parts":[{"partno":12}, {"partno":16}, {"partno":27}], "inventory":{"instock":12, "ordered":10}}

    Then the following are valid output field names that could be added to a Get Multiple card along with their types and the values that would be returned:

    Output field Type Value
    product text a123
    parts.1.partno number 16
    inventory object {“instock”:12, “ordered”:10}
    inventory.ordered number 10
  • Keys

    The Keys card will generate a list of the keys within your object.

    Input Fields

    • object:  the object you want to extract keys from

    Output Fields

    • output: the keys of your object organized as a list of text

    Examples

    If input object is{"Name":"Emily", "Age":"66", "Hair Color":"Brown", "Eye Color":"175"}
    Then output is the list: ["Name", "Age", "Hair Color", "Eye Color"]

  • Map

    Processes an object key-by-key using a child Flow, creating a new object as output.  For each key in the input object, the child Flow is called with the key name and value for that key - you can select those using the dropdown in the designer after selecting a child Flow using the Choose Flow button.

    screen-shot-2016-11-22-at-3-58-21-pm

    The child Flow must output two values, key and value, using a Return card.  Each key/value pair will form one key in the output object. The child Flow can also filter out some of the keys by using Continue If or similar logic - if the child Flow completes without returning a key/value pair, then that iteration will not contribute a key to the output object.

    Input Fields

    • object (required): the object or list of objects you want to process
    • flow (required): the child Flow to process each key/value pair
    • (dynamically generated):  the inputs defined by the child Flow
    • concurrency: how many keys to process in parallel

    Output Fields

    • output: the new object formed by the key/value pairs from the child Flow

    Example

    Suppose you wanted to filter an object by removing all keys who have a value starting with the letter “t”. You can do that with the following child Flow - it accepts key and value, gets the first letter of value, and if that letter is not “t” then it echoes back the same key and value.

    screen-shot-2016-11-23-at-4-47-57-pm

    That Flow, when used with Map, will turn this object:

    { “this”: “that”, “up”: “down”, “left”: “right”, “one”: “two” }

    into this:

    { “up”: “down”, “left”: “right” }

  • Map to List

    Iterates through an object key-by-key using a child Flow, creating a list as output, with one item in the list per key in the object. For each key in the input object, the child Flow is called with the key name and value for that key - you can select those using the dropdown in the child Flow inputs after selecting a child Flow using the Choose Flow button.

    screen-shot-2016-11-25-at-3-40-53-pm

    The output of the child Flow should match whatever type is specified for new list. There will be one output list item for each key/value pair in the input object.

    Input Fields

    • object (required): the object or list of objects you want to pick values from
    • flow (required): the child Flow to process each key/value pair
    • (dynamically generated):  the inputs defined by the child Flow
    • concurrency: how many keys to process in parallel

    Output Fields

    • new list: the new list formed by the key/value pairs from the child Flow.

    Example

    Suppose you wanted to convert an object into a list of objects, where each key/value pair is converted to an object that has “propertyname” and “propertyvalue” keys - this is a common pattern among cloud APIs.  Suppose the propertyname also needs to be prefixed with “custom:“.  You can do that with the following child Flow - it accepts key, value, and a constant prefix (which is the same across all iterations - the parent Flow should pass this in), and returns back an object with 2 keys:

    screen-shot-2016-11-25-at-3-58-52-pm

    That Flow, when used with Map to List, will turn this object:

    { "this": "that", "up": "down", "left": "right" }

    into this list:

    [
        {
            "propertyname": "custom:this",
            "propertyvalue": "that"
        },
        {
            "propertyname": "custom:up",
            "propertyvalue": "down"
        },
        {
            "propertyname": "custom:left",
            "propertyvalue": "right"
        }
    ]
  • Merge

    Merges multiple objects into a single object. The output object has all of the keys (with their associated values) that appear in any of the input objects. If the same key appears in more than one of the input objects, only one value is taken. There are two inputs by default, but more can be added.

    Input Fields

    • object 1: an object to merge
    • object 2: a second object to merge
    • Note: You can merge a third object by clicking the gray placeholder input or dragging-and-dropping an object into it. Afterwards, a new placeholder will appear for a fourth (or more) input(s).

    Output Fields

    • output: the newly merged object

    Example:

    object 1: {"email":"jane@doe.com", "id":123}
    object 2: {"email":"jane@doe.com", "first":"Jane", "last":"Doe"}
    output: {"email":"jane@doe.com", "id":123, "first":"Jane", "last":"Doe"}

  • Move

    Moves a value from one key to another key, which essentially renames the key while keeping the value the same.

    Input Fields

    • object:  the object to manipulate
    • source:  the key in the original _object_ containing the value you wish to rename
    • destination:  the new key to move the value to

    Output Fields

    • output:  the new object with the renamed key-value pair now at the end of the object

    Examples

    If the input object is: {"one":"hello", "two":"goodbye"}
    And source is one and destination is three
    Then the output object will be: {"two":"goodbye", "three":"hello"}

  • Set

    Sets a key of an object to a specified value, creating a new key if it doesn’t exist already.

    Input Fields

    • object:  the object you are starting with
    • path:  can be a single top-level key name (e.g. “customer”), a dot-delimited path (e.g. “customer.id” where “id” is a key inside a sub-object or “items.5” where 5 is an element inside a list), or you can change the type of path to accept a list of text each containing a single key name for the path
    • value:  the new value for the key. Be sure to set the type of value to match the desired type (e.g. text or number) for the key.

    Output Fields

    • output:  the new object containing the updated value in the specified path

    Examples

    If object is {"foo":"1"}, path is foo, and value is 2, then output is {"foo":"2"}.

    If object is {"foo":"1"}, path is bar, and value is 2, then output is {"foo":"1","bar":"2"}.

    If object is {"foo":"1"}, path is bar.baz, and value is 2, then output is {"foo":"1","bar":{"baz":"2"}}.

    If object is {"foo":["0","1","2"]}, path is foo.1, and value is 9, then output is {"foo":["0","9","2"]}.

    If object is {"foo":{"bar":"1"}}, path is foo.bar and value is 2, then output is {"foo":{"bar":"2"}}.  

    Alternatively, you can set the type of path to be a list of text and then pass in “foo” and “bar” as the list items to get the same result.

    When using a list of text, dots are assumed to be part of the desired key name so using foo.bar as the input if path is set to a list would result in the output {"foo":{"bar":1},"foo.bar":2}

  • Size

    Returns the number of elements in an object.

    Input Fields

    • object (object): the object to get the size of

    Output Fields

    • size (number): the number of elements in the object; for example the following object would return the value 2 { "element1":"a", "element2":"b" }
  • Unset

    Deletes a key/value pair from an object.

    Input Fields

    • object:  the object to delete the key/value pair from
    • path:  the key to delete; either a top level key name, a dot-delimited path to a subkey, or a list of key names. (see examples below)

    Output Fields

    • output:  the new object

    Examples

    For the simple case where you want to delete a top-level key, just provide the key name as the path. For instance, if the object is {"foo":1, "bar":2} and _path_ is “foo”, then output will be {"bar":2}.

    A path can also be used to specify a key within a sub-object where a dot indicates a sub-object.  For example, if _object_ is {"a":"one", "b":{ "foo":1, "bar":2}} and path is “b.foo”, then output is {"a":"one", "b":{ "bar":2}}

    You can also use a number to indicate the nth element of a list, so a valid path would be “foo.7.bar” which indicates that you want to delete the “bar” key/value pair on the 7th element of the list of objects at the “foo” key.

    This dot-delimited path is simple and powerful, but it doesn’t work in all cases:  it may not work if a) your key names include dots within them, or b) your key names are numbers.  In that case, you can control the path explicitly by using a list of text; each item in the list will be treated as a single key (no attempts to interpret numbers or dots).  For example, if object is {"a":"one", "b.foo":{ "7":"bar", "8":"baz"}}, you’ll need to set path to be a list (using the type dropdown) with the first item “b.foo” and the second item “7” if you want to get the _output_ {"a":"one", "b.foo":{ "8":"baz"}}

  • Values

    The Values card will generate a list of the values within your object,

    Input Fields

    • object:  the object you want to extract values from

    Output Fields

    • output: the values of your object organized as a list, the list type can be selected based on the values within your object

    Examples

    If input object is {"Name":"Emily", "Age":"66", "Hair Color":"Brown", "ID":"175"}
    Then _output_ is the list: ["Emily", "66", "Brown", "175"]

  • Zip

    Create an object from two lists, by mapping keys from the first lists to values from the second.  This is particularly useful when creating an object that has keys with dots in the key names.  

    Because dots usually refer to sub-objects, it can be difficult to create objects that have key names with dots in them.

    For example, if you want to generate this object:

    {
        "first.name": "John",
        "last.name": "Doe"
    }

    you could create it using Object - Zip with these two inputs:

    • keys: [ "first.name", "last.name" ]
    • values: [ "John", "Doe" ]  

    Input Fields

    • keys (list of text):  a list of key names
    • values (list - you set the type):  a list of values. This list should have the same number of items as keys.

    Output Fields

    • object (object):  the newly-created object using the keys and values provide