This is my json
{
"accessType":"Grant",
"spaces":[{"spaceId":"5c209ba0-e24d-450d-8f23-44a99e6ae415"}],
"privilegeId":"db7cd037-6503-4dbf-8566-2cca4787119d",
"privilegeName":"PERM_RVMC_DEV",
"privilegeDescription":"RVMC Dev",
"privilegeType":"Permission"
}
And here's my class:
public class ProfilePrivilege
{
public AccessType AccessType { get; set; }
public Guid PrivilegeId { get; set; }
public string PrivilegeName { get; set; }
public string PrivilegeDescription { get; set; }
public PrivilegeType PrivilegeType { get; set; }
public List<Guid> spaces;
}
When the spaces array is not null I get an error deserializing. I can get around this by simply creating a wrapper class for Guid
public class Space
{
public Guid spaceId;
}
and then instead of List<Guid>
I can have a List<Space>
in my Privilege class and it's all fine. But I was wondering if there's a better way to do this as I don't want to have a redundant wrapper class just for that. So is there any easy way to get around this without writing a custom deserializer for my Privilege type objects ?
I'm deserializing with JSON.Net btw.