can anyone can help me on how to add an array to jwt token of identityserver4 in the format below .
If array contains no data : { "custom_data" : [] }
If array contains one element : { "custom_data" : ["one_element"]}
If array contains multiple elements : { "custom_data" : ["first element","second element"]}
I have tried using IProfileService and added data by using Claims
sample code :
foreach (string element in my_array) {
userClaims.Add(new Claim("custom_data" , element));
}
But in that case what I'm getting is as follows :
if array contains no data : { } here I'm not getting any data
if array contains one element : { "custom_data" : "one_element"} Here I'm getting it as a string
if array contains multiple elements : { "custom_data" : ["first element","second element"]} Here I'm getting in a correct way