ASP.NET MVC Json Enum
- by IceHeat
public class Member
{
public string Name { get; set; }
public Role Role { get; set; }
}
public enum Role
{
Plumber
}
public JsonResult GetMember()
{
Member member = new Member();
member.Name = "Joe the Plumber";
member.Role = Role.Plumber;
return Json(member);
}
The Json always resolves the enum "Role" as 0,despite its value. What is the quickest way to get the string representation?