- 在序列化时中实现
var json = JsonConvert.SerializeObject(model, new StringEnumConverter());
- 在定义类时添加属性
class ThreadModel
{
public System.Threading.ThreadState ThreadStateEnum { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public TaskStatus TaskStatusEnum { get; set; }
}