Using Json.net - partial custom serialization of a c# object

前端 未结 3 423
萌比男神i
萌比男神i 2020-12-11 02:44

I ma using Newtonsofts\' Json.Net to serialize some and array of objects to json. The objects have a common set of properties but also have Meta property which is a diction

3条回答
  •  不思量自难忘°
    2020-12-11 03:03

    You can do this by creating your own JsonConverter and then adding an attribute to the class you want to serialize [JsonConverter(typeof(MyConverter))]

    Example here - http://www.lostechies.com/blogs/rhouston/archive/2008/02/25/a-custom-converter-for-json-net.aspx

提交回复
热议问题