Converting a String to an Array Using Okta Expression Language
Last Updated:
Overview
Administrators convert a string into an array using the Okta Expression Language (OEL) during attribute mapping. The Okta Expression Language provides array functions that facilitate data transformation when specific operations or applications require different data types.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Expression Language (OEL)
- Attribute Mapping
Solution
How does the Okta Expression Language convert a string to an array?
Combine the Arrays.toCsvString({}) and Arrays.add() functions in the Okta Expression Language to convert an empty array to a comma-separated values (CSV) string and add the specific string as an element
Arrays.add(Arrays.toCsvString({}),<string>)
- In this expression, replace
<string>with the variable to map or specific text as per the requirements. - Convert an empty array to a CSV string using the
Arrays.toCsvString({})function, and then using theArrays.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. - 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:
