I can't access all of json data that it is deserialized by json.net. How can I access it. It's null when I WriteLine in console.
Account.cs
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
main class
string json2 = @"{'Accounts' :[{
'Email': '[email protected]',
'Active': true,
'CreatedDate': '2013-01-20T00:00:00Z',
'Roles': [
'User',
'Admin']
},
{
'Email': '[email protected]',
'Active': true,
'CreatedDate': '2013-01-20T00:00:00Z',
'Roles': [
'Userz',
'Adminz'
]
}]}";
List<Account> account = new List<Account>();
account.Add(JsonConvert.DeserializeObject<Account>(json2));
// [email protected]
Console.Write(account[0].Email);