Object Functions

  • fn.object_keys: Given an object and additional optional parameter, return the list of keys that match the parameter value, or all the keys if no parameter value is given.

Example object:

{
  "input": {
     "object": {
       "boolean_1": true,
       "boolean_2": false,
       "boolean_3": true,
       "string_1": "1",
       "string_1_dup": "1",
       "string_2": "2",
       "integer_1": 1,
       "integer_1_dup": 1,
       "integer_2": 2

  }
}

Examples:

Example Output
{{ fn.object_keys input.object,true }}


{{fn.object_keys input.object,"1"}}



{{fn.object_keys input.object,1}}



{{fn.object_keys input.object}}
["boolean_1","boolean_3"]


["string_1","string_1_dup"]



["integer_1","integer_1_dup"]



["boolean_1","boolean_2",
 "boolean_3","string_1",
 "string_1_dup","string_2",
 "integer_1","integer_1_dup",
 "integer_2"]
  • fn.object_empty: Returns and empty object

Example:

Example Output
{{ fn.object_empty }}
{}
  • fn.object_update - Given an existing object and a key-value pair, updates and returns the given object with the key and value.
    • If the key dows not exist, the pair is added.
    • If the key exists, the value is updated.

Examples:

Example Output

my_object:

{ "existing_key": "some_value" }

function call:

{{ fn.object_update "key", "1234",
                    input.my_object }}
{ "existing_key": "some_value",
   "key": "1234" }

my_object:

{ "key": "some_value" }

function call:

{{ fn.object_update "key", "1234",
                    input.my_object }}
{ "key": "1234" }