title: Json.NET serialize List<System.Enum> and back to concrete types
body: <p>I have a <code>UserProfile</code> C# class that contains a public list <code>List&lt;System.Enum&gt; Bonuses;</code>, whose elements each belong to one of several concrete types of Enums: <code>BonusUI</code>, <code>BonusMusic</code>, <code>BonusMode</code>, etc.</p>
  
  <p>I'm using Json.NET and I wanted to serialize/deserialize the <code>UserProfile</code> object. I applied the <code>[JsonConverter(typeof(StringEnumConverter))]</code> to each concrete enum type, so that they are saved as strings instead of ints. However, this is not enough, as the saved enum values don't even contain their exact type.</p>
  
  <pre><code>...
  "Bonuses": [
      "MainTheme",
      "ClassicUI",
      "WoodUI",
      "Rampage",
      "SoleSurvivor"
  ],
  ...
  </code></pre>
  
  <p>For example, see this error when the deserializer finds BonusMusic.MainTheme (serialized as "MainTheme") inside the list:</p>
  
  <blockquote>
    <p>Error converting value "MainTheme" to type 'System.Enum'.</p>
  </blockquote>
  
  <p>How could I solve this?</p>