Deserialize Json string to Enum C#
问题 I am writing a test on a custom version of stringEnumConverter. But my test keeps throwing when I deserialize. I searched over stack overflow, but could not find what I did wrong. Following is a sample of what I'm doing: namespace ConsoleApp2 { [Flags] [JsonConverter(typeof(StringEnumConverter))] enum TestEnum { none = 0, obj1 = 1, obj2 = 2 } class Program { static void Main(string[] args) { var jsonString = "{none}"; var deserializedObject = JsonConvert.DeserializeObject<TestEnum>(jsonString