'Deserialize JSON Numbers into Enums
I have the below enum:
public enum AnEnum
{
Value1 = 1,
Value2 = 2,
Value3 = 3
}
And I have the below class:
public class AClass
{
public string AString { get; set; }
public List<AnEnum> Enums { get; set; }
}
And the below JSON string:
{"AString": "a string", "Enums": [1,2]}
How can I get an AClass instance out of the JSON string with the enums properly converted into the AnEnum type?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
