This is the example json from json.net website
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
usage:
string json = @"{
'Email': '[email protected]',
'Active': true,
'CreatedDate': '2013-01-20T00:00:00Z',
'Roles': [
'User',
'Admin'
]
}";
Account account = JsonConvert.DeserializeObject<Account>(json);
Console.WriteLine(account.Email);
But when I run it I'm getting error:
Unable to find a constructor to use for type Gogch.Account. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Email', line 1, position 9.
I added an empty constructor as said in another topic, but I'm still getting the same error. Any help is appreciated.
Account, then?