<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
0D5WR00001iahxm0AAOkta Classic EngineUniversal DirectoryAnswered2026-06-01T21:39:29.000Z2026-06-01T19:37:56.000Z2026-06-01T21:39:29.000Z

IsaacB.81593 (Customer) asked a question.

JSON/Object in stringSwitch expression

I'm trying to map an Okta attribute value to Cornerstone. The attribute is "Organization." In Cornerstone, this attribute is an "object" type.

 

It appears that I can map a set of values via a JSON literal in Profile Editor, e.g., {"id":0,"name":"xxxx","typeId":2}:

 

/help/servlet/rtaImage?refid=0EMWR00000XmAIE

But I want to do this with a stringSwitch expression, as in

 

String.stringSwitch(user.department, {default JSON},"accounting",{accounting JSON})

 

But I get "Error in evaluating expression" in Profile editor.

 

Is there a way to sent JSONs in the stringSwitch expression?

 

Thanks

 

 

 


  • Hi @IsaacB.81593 (Customer)​ , Thank you for reaching out to the Okta Community! 

     

    I could not find any explicit use cases for JSON use in conjunction with the attribute mappings functions and I don't have an app integration with a sample attribute of the "object" type to test with and confirm.  

    That being said, just to validate the syntax structure I tested a couple of things with a generic string attribute using the following: 

     

    String.stringSwitch(user.department, '{"id":0,"name":"Default","typeId":2}', "accounting", '{"id":1,"name":"Accounting","typeId":2}')  

     

     

    Here are the results for a test user: 

     

    >When the user's "Department" attribute is set to something like "sales" - > output is:

    "{\"id\":0,\"name\":\"Default\",\"typeId\":2}"

      (l'ame 

     

    >When the user's "Department" attribute is set to something like "accounting" - > output is:

    "{\"id\":1,\"name\":\"Accounting\",\"typeId\":2}"

    String 

     

    I'm not sure your downstream app will parse this in the expected values, though. The String.stringSwitch function's return type will be "string". You will need to test and confirm.  

     

     

     

    If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you. 

     

    Hope my answer helps! 

     

    --

    Help others in the community by liking or hitting Select as Best if this response helped you.

    Collect them all. Learn a new skill and earn a new Okta Learning badge.

    Just released: More Okta Community badges just added

    Expand Post
  • IsaacB.81593 (Customer)

    Hello Mihai. When I enclose the JSON in quotes, I get an error: "Invalid value data type for property 'Organization'" That's expected as I'm now sending a string for an Object type. Thank you.

Loading
JSON/Object in stringSwitch expression