Deserializing with Json.NET: Requiring a property/key to be present

后端 未结 3 1413
北海茫月
北海茫月 2020-12-20 19:20

When using Json.NET to deserialize a JSON string into an object, how do I require a key/property to be present in the JSON stirng, but allow for NULL values?

For exa

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 19:47

    I think you are looking for the DefaultValueAttribute http://james.newtonking.com/projects/json/help/index.html?topic=html/T_Newtonsoft_Json_DefaultValueHandling.htm

提交回复
热议问题