Deserialize Dictionary with enum values in C#

前端 未结 2 1998
野性不改
野性不改 2020-12-01 22:18

I am trying to serialize/deserialize a Dictionary in C#. Object can be anything that is serializable.

Json.NET almost works, but i

2条回答
  •  隐瞒了意图╮
    2020-12-01 22:42

    Assuming you have access to modify the object class, you can add the JsonCoverter attribute to the enum member of the class.

    [JsonConverter(typeof(StringEnumConverter))]
    

提交回复
热议问题