deserialize json to object c#
dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonstring);
deserialize json to object c#
dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonstring);
c# deserialize object / class newtonsoft
// Create a class of the json
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
// This is an example of the json format to deserialize
string json = @"{
'Email': '[email protected]',
'Active': true,
'CreatedDate': '2013-01-20T00:00:00Z',
'Roles': [
'User',
'Admin'
]
}";
// Deserialize it (the example)
Account account = JsonConvert.DeserializeObject<Account>(json);
// Output the result [in this case we're testing the email of the account].
Console.WriteLine(account.Email);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us