I have a Token Profile we are using to process a JWT token. The token has a custom claim including a JSON array (format looks like: ["value1", "value2",...]). I am trying to get this onto the clipboard but I get the following error when mapping it to a simple Text Property, during authentication:
Unable to process the Json Web Token com.pega.pegarules.pub.clipboard.InvalidParameterException: class "net.minidev.json.JSONArray" does not match mode "String" of property "Page.Property". Details: Invalid value for aValue passed to com.pega.pegarules.data.internal.clipboard.ClipboardPropertyStrMinFeatureImpl.setValueOverride(Object)
I have tried using a Value List Property and other types, but nothing seems to help.
I was wondering if anyone knows of a way to process this sort of situation. Thanks for any help.
Update on 2/21/2022: I figured out that I can use the Payload as JSON string field at the bottom of the Token Profile rule to map the entire token payload onto the clipboard in one long string. This includes the specific claim I want so I can use substrings to get what I need. What I was hoping to do instead is map just the claim directly from the JWT without having to take the entire payload. It seems more efficient to do it that way if I can get it to work. So I'd like to leave this open in case there are other better answers to this question.
***Edited by Moderator Marissa to add Capability tags***
I opened SR INC-212667 for help with this. I was recommended to create a new property of type Java Object with a Java class of net.minidev.json.JSONArray. From this I am able to parse the JSON array from the JWT token into it. From there, I can use a Java step in an activity to get the value of the property as a string: