<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 String to Array using Okta Expression Language
Okta Classic Engine
Lifecycle Management
Overview

This article demonstrates how to convert a string into an array using Okta's Expression Language. This process can be particularly useful in attribute mapping, where transforming data types may be necessary for specific operations or applications.

Applies To
  • Attribute mapping 
  • String to Array conversion
  • Okta Expression Language (OEL)
Cause

In specific scenarios, it may be necessary to convert a string to an array in Okta, particularly during attribute mapping processes. The Okta Expression Language provides a set of array functions that can facilitate this type of data transformation.

Solution

To convert a string to an array, combine two array functions in the Okta Expression Language as follows:

Arrays.add(Arrays.toCsvString({}),<string>)
  1. In this expression, replace <string> with the variable to map or specific text as per the requirements.
  2. Convert an empty array to a CSV string using the Arrays.toCsvString({}) function, and then using the Arrays.add() function to add the specific string to this array. The end result will be an array that contains the specified string as an element.
  3. The function can be expanded to include multiple values in the array from different attribute sources by enclosing the expression in another Arrays.add(arrayPlacedHere,newStringHere)expression as follows:
Arrays.add(Arrays.add(Arrays.toCsvString({}),<string>),<string2>)


Example: 

String

 

 
Loading
How to Convert String to Array using Okta Expression Language