Map Objects

Map a list of objects onto another list of objects by using a list of mappings.

mappings contains the list of mappings to use to create the new list. Each mapping is an object that contains src and dest paths, which are required, and optionally a transform key. Each mapping is applied to each element in the input list in the order specified. If the strict input is false, then any errors that occur during transformations will be ignored.

For example, consider the following inputs:

list = [

    {"a":1, "b":"true", "c":{"d":"5"} },

    {"a":3, "b":"false", "c":{"d":"6"} }



mappings = [

   { "src":"a", "dest":"newA", "transform":"toString" },

   { "src":"b", "dest":"newB", "transform":"toBoolean" },

   { "src":"c.d", "dest":"c.newD" }



strict = (true|false)

This function takes the input list, applies the mapping specified by mappings and outputs the following:



        "newA": "1",

        "newB": true,

        "c": {

            "newD": "5"



            "newA": "3",

            "newB": false,

            "c": {

                "newD": "6"




Input Fields

  • list (List of Objects) - the list of objects that you want to map to a new list
  • mappings (List of Objects) - the list of mappings to apply to list
  • strict (Boolean) - set to False to ignore any errors during transformations, otherwise set to True

Output Fields

  • output - the resulting list of mapped objects

See Also

About lists


About the elements of Okta Workflows