Jump to content
Welcome to our new Citrix community!
  • 0

Need example how to correct deserialize json output


Carsten Bartholomä-Link

Question

1 answer to this question

Recommended Posts

  • 0

@Carsten Bartholomä-Link

 

https://discussions.citrix.com/topic/404429-what-is-the-right-api-call-to-request-the-bearer-token-cwsauth/?do=findComment&comment=2047763 contains an example of deserialising JSON response from the trust API. I'll paste the relevant parts here:

 

// class describing the object
class TrustResponse
    {
        public string principal { get; set; }
        public string locale { get; set; }
        public string subject { get; set; }
        public string token { get; set; }
        public string openIdToken { get; set; }
        public int expiresIn { get; set; }

    }

// snippet deserializing the string response 'content'
var responseObj = Newtonsoft.Json.JsonConvert.DeserializeObject<TrustResponse>(content);
var bearerToken = responseObj.token;

You would need to install the required Nuget Package

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...