当源是json时,是否可以设置Automapper将索引和值都转换为枚举?

我正在编写一个测试脚本,其中源数据是json字符串。参数之一是枚举,并且源数据可以是枚举的索引值或字符串值。

I have the Automapper profile setup to properly convert the string value to the enum in the model, but I cannot determine how to write the profile to handle both scenarios? Is it possible to write a profile to handle both sample json's below?

// Sample JSON One
{
  "Category": 3
}

// Sample JSON Two
{
  "Category": "SERVICE"
}

public enum Category
{
    REPAIR,
    SERVICE,
    MONITOR,
    REPLACE
}

public class CategoryModel
{
    public Category categoryType { get; set; }
}

public JsonTestProfile()
{
    // This works for Sample 2, but not Sample 1
    CreateMap<JObject, CategoryModel>()
        .ForMember("categoryType", option => { option.MapFrom(json => json["Category"].ToString()); });
}

public void JsonAutoMapperTst()
{
    //Assemble
    var config = new MapperConfiguration(cfg =>
    {                
        cfg.AddProfile<JsonTestProfile>();
    });
    var mapper = config.CreateMapper();

    var folderDetails = Path.Combine(Directory.GetCurrentDirectory(), $"Sample.json");
    var jsonText = System.IO.File.ReadAllText(folderDetails);
    var jsonObj = JObject.Parse(jsonText);

    CategoryModel request = mapper.Map<JObject, CategoryModel>(jsonObj);    
}