I'm using the json deserialiser by newtonsoft, and I am deserialising this object inside a wrapper:
public class User
{
public string Username;
public byte[] HashedPassword;
public byte[] Salt;
private bool admin;
public bool Admin
{
get { return admin; }
}
public User(string UsernameArg, byte[] PasswordArg, byte[] SaltArg, bool AdminArg = false)
{
Username = UsernameArg;
HashedPassword = PasswordArg;
Salt = SaltArg;
admin = AdminArg;
}
public override string ToString()
{
return Username;
}
}
This is my json string:
{"Users":[{"Username":"admin","HashedPassword":"password","Salt":"salt","Admin":true}]}
(I've edited the hashed password and the salt for readability)
So whenever I read this using JsonConvert.DeserializeObject<UserDatabaseClass>(jsonRead)
the admin field is returning false.
Is it just that I have misunderstood what this is doing here or am I doing it incorrectly?