<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

How to Convert an Object to a List in Okta Workflows

Workflows
Okta Classic Engine
Okta Identity Engine

Overview

Convert an object to a list in Okta Workflows by utilizing the Object - Map to List card. This card takes an object and converts it into a list using a helper flow, mapping each property of the object to a key/value pair.

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Workflows

Solution

How is an object converted to a list in Okta Workflows?

 

The Object – Map to List card takes an object and converts it to a list using a helper flow.

For example: 

  • For example, if having this object:

{  "drink": "wine",  "main course": "chicken",  "appetizer ": "salad",  "desert": "ice cream"}

  • It can be converted to a list where each property from the object becomes a key/value pair:

[   {      "key": "drink",      "value": "wine"   },   {      "key": "main course",      "value": "chicken"   },   {      "key": "appetizer",      "value": "salad"   },   {      "key": "desert",      "value": "ice cream"   }]

 

Review the main flow configuration image, which demonstrates the Object - Map to List card passing the JSON object to the helper flow.

Main Flow

Review the helper flow configuration image, which demonstrates how to process the object into a list by mapping its keys and values.

Helper Flow

Review the resulting JSON list generated by the flow upon execution, which displays each meal item as a separate key-value pair.

[
   {
      "key": "drink",
      "value": "wine"
   },
   {
      "key": "main course",
      "value": "chicken"
   },
   {
      "key": "appetizer ",
      "value": "salad"
   },
   {
      "key": "desert",
      "value": "ice cream"
   }
]

How is additional information passed to the helper flow?

Okta Workflows supports passing additional information to the helper flow. For example, the flow adds a prefix like "dinner" to the keys.

Review the updated main flow image, which demonstrates the main flow passing a constant prefix string to the helper flow alongside the object.

Updated Main Flow

Review the updated helper flow image, which demonstrates concatenating the prefix string with the original key to create a new key value.

Updated Helper Flow

Review the resulting JSON list that the updated flow generates upon execution, which displays the concatenated prefix and key alongside the corresponding value.

[
   {
      "key": "dinner:drink",
      "value": "wine"
   },
   {
      "key": "dinner:main course",
      "value": "chicken"
   },
   {
      "key": "dinner:appetizer ",
      "value": "salad"
   },
   {
      "key": "dinner:desert",
      "value": "ice cream"
   }
]

Related References

Loading
How to Convert an Object to a List in Okta Workflows | Okta Support