Hi @Blooming Developer ,
From your description of this question, I think you want to desrialize json to objects. So you can check this simple demo.
Let's remove escape characters from this json:
{
"AccessRights": [],
"ADAttributes": [
{
"AD": "teenajohn",
"ADFull": "",
"DisplayName": "Teena John",
"FirstName": "Teena",
"Initials": "",
"EmployeeNumber": "1111111",
"LastName": "John",
"EmailAddress": "******@gmail.com",
"Department": "Information Systems",
"Title": "System Analyst",
"BusinessPhone2": "6666111111",
"Mobile": "",
"CleanMobile": "",
"Okta": "******@gmail.com"
}
],
"OktaAttributes": [
{
"Okta": "******@gmail.com",
"AD": "teenajohn",
"EmployeeNumber": "1111111",
"FirstName": "Teena",
"LastName": "John",
"Email": "******@gmail.com",
"SecondEmail": "",
"ManagerAD": "",
"ManagerEmail": "",
"HRAdvisor": "",
"Title": "System Analyst",
"RockFunction": "",
"Mobile": "",
}
],
"IsPublic": false,
"AuthenticateType": 1
}
There are five properties in this json: AccessRights
,ADAttributes
,OktaAttributes
,IsPublic
,AuthenticateType
.
So you can create a class contains these properties.
AuthenticateUserInfo
public class AuthenticateUserInfo
{
public List<AccessRights> accessRights { get; set; }
public List<ADAttributes> adAttributes { get; set; }
public List<OktaAttributes> oktaAttributes { get; set; }
public bool IsPublic { get; set; }
public int AuthenticateType { get; set; }
}
ADAttributes
public class ADAttributes
{
public string AD { get; set; }
public string ADFull { get; set; }
public string DisplayName { get; set; }
public string FirstName { get; set; }
public string Initials { get; set; }
public string EmployeeNumber { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public string Department { get; set; }
public string Title { get; set; }
public string Manager { get; set; }
public string BusinessPhone2 { get; set; }
public string Mobile { get; set; }
public string CleanMobile { get; set; }
public string Okta { get; set; }
}
OktaAttributes
public class OktaAttributes
{
public string Okta { get; set; }
public string AD { get; set; }
public string EmployeeNumber { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string SecondEmail { get; set; }
public string ManagerAD { get; set; }
public string ManagerEmail { get; set; }
public string HRAdvisor { get; set; }
public string Title { get; set; }
public string RockFunction { get; set; }
public string Mobile { get; set; }
}
Then you can use:
AuthenticateUserInfo AuthenticateUserInfo = JsonConvert.DeserializeObject<AuthenticateUserInfo>(content);
to get the value.
DEMO:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Xinran Shen