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"}}

See Also

Functions

About the elements of Okta Workflows