Object Functions ---------------- .. index:: Macro function;fn.is_object * *fn.is_object*: Return true or false if the parameter is an object or not. .. index:: Macro function;fn.object_keys * *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: .. tabularcolumns:: |p{8cm}|p{7cm}| +------------------------------------------------+-----------------------------------------------+ | Example | Output | +================================================+===============================================+ | :: | :: | | | | | {{ fn.object_keys input.object,true }} | ["boolean_1","boolean_3"] | | | | | | | | {{fn.object_keys input.object,"1"}} | ["string_1","string_1_dup"] | | | | | | | | | | | {{fn.object_keys input.object,1}} | ["integer_1","integer_1_dup"] | | | | | | | | | | | {{fn.object_keys input.object}} | ["boolean_1","boolean_2", | | | "boolean_3","string_1", | | | "string_1_dup","string_2", | | | "integer_1","integer_1_dup", | | | "integer_2"] | | | | +------------------------------------------------+-----------------------------------------------+ .. index:: Macro function;fn.object_empty * *fn.object_empty*: Returns and empty object Example: .. tabularcolumns:: |p{8cm}|p{7cm}| +--------------------------+--------+ | Example | Output | +==========================+========+ | :: | :: | | | | | {{ fn.object_empty }} | {} | | | | +--------------------------+--------+ .. index:: Macro function;fn.object_update * *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: .. tabularcolumns:: |p{8cm}|p{7cm}| +------------------------------------------+------------------------------------+ | Example | Output | +==========================================+====================================+ | my_object: | | | | | | :: | | | | | | { "existing_key": "some_value" } | | | | | | function call: | | | | | | :: | :: | | | | | {{ fn.object_update "key","1234", | { "existing_key": "some_value", | | input.my_object }} | "key": "1234" } | | | | | | | +------------------------------------------+------------------------------------+ | my_object: | | | | | | :: | | | | | | { "key": "some_value" } | | | | | | function call: | | | | | | :: | :: | | | | | {{ fn.object_update "key","1234", | { "key": "1234" } | | input.my_object }} | | | | | | | | +------------------------------------------+------------------------------------+ .. |VOSS Automate| replace:: VOSS Automate .. |Unified CM| replace:: Unified CM