List Input for Omnistudio Data Mappers (Managed Package)

For the managed package runtime, Data Mappers can perform list transformations. For mapping input to output, Data Mappers require a list input in which every value is paired with a key.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

For example, the following lists are valid, and each can be converted to the other.

List 1:

{
 "Oldest": "Huey",
 "Middle": "Dewey",
 "Youngest": "Louie"
}

List 2:

{
    "Nephews": [
        {
            "Name": "Huey"
        },
        {
            "Name": "Dewey"
        },
        {
            "Name": "Louie"
        }
    ]
}

List 1 lacks a JSON node for the list as a whole, and each value has a different key. List 2 has its own JSON node, and each list item has the same key.

Note
Note

Loop Block components in Integration Procedures require input that is structured like List 2. The list-item key itself can contain key-value pairs.

To convert List 1 to List 2, use the following mappings on the Transforms tab of a Data Mapper Transform. The |1, |2, and |3 are list position indexes.

Input JSON Path

Output JSON Path

Oldest

Nephews|1:Name

Middle

Nephews|2:Name

Youngest

Nephews|3:Name

To convert List 2 to List 1, use the reverse mappings.

To download data packs of Data Mapper Transforms for these mappings, click these links:

Importing Omnistudio for Managed Packages data packs into Omnistudio orgs is supported, and conversion is automatic. However, importing Omnistudio data packs into Omnistudio for Managed Packages orgs isn't supported.

In the following list, values don't have keys.

List 3:

{
  "Nephews": [
    "Huey",
    "Dewey",
    "Louie"
  ]
}

You can convert List 1 to List 3 using the following mappings:

Input JSON Path

Output JSON Path

Oldest

Nephews|1

Middle

Nephews|2

Youngest

Nephews|3

However, you can't convert List 3 to either List 1 or List 2.

To convert List 2 to List 3, and to perform such conversions of lists of any length, see Convert a List of Objects to a List of Values (Managed Package).

If each object of a list has a different key, Data Mapper Transform creates a single map with combined key and value pairs from that list, and ignores any empty values. Here’s an example for products for an ecommerce website:

{
    "Cleaning products": [
        {
            "Name": "WonderProduct"
            "Property": ""
        },
        {
            "Name": ""
            "Property": "Fast-acting"
        },
        {
            "Scent": "Lavender"
        }
    ]
}

Transformed output list:

{
    "Cleaning products": [
        {
            "Name": "WonderProduct"
            "Property": "Fast-acting"
            "Scent": ":Lavender"
        }
    ]
}

For more that you can do with lists, see: