<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 Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This article describes how to convert an object to a list.

Applies To
  • Okta Workflows
Solution

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

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

  1. This is the main flow:

Workflows

  1. And this is the helper flow:

Workflows

 

  1. Result running the flow:

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

 
  1. Also, additional information can be passed to the helper flow. For example, if there is a need to pass in a prefix (dinner) to get the following result:

[   {      "key": "dinner:drink",      "value": "wine"   },   ...]

  • The updated main flow with a constant prefix passed to the helper flow:

Workflows

  • In the update helper flow, the prefix is concatenated with the key to create a new key value:

Workflows

  • Result running the updated flow:

[   {      "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 Workflows