1.JsonConverter
简单的将一个对象序列化,不做其他处理
JsonConverter.SerializeObject(object);
2.JsonSerializer
对序列化提供更多的控制
2.1 DateFormatHandling 控制时间的序列化
并没有yyyy-MM-dd 类似的格式,看来要自己写
2.2 MissingMemberHandling
当json中有的属性实体类中没有时的处理
2.3 ReferenceLoopHandling 循环引用处理
2.4 NullValueHandling 空值处理
两种情况 对象中有个属性没有值时的序列化处理;json中有个属性没有值的反序列化处理
可以通过JsonPropertyAttribute自定义
2.5 DefaultValueHandling 默认值处理
可以自定义
2.6 ObjectCreationHandling
控制反序列化过程中对象如何被生成和反序列化
可自定义
2.7 TypeNameHandling
TypeNameHandling controls whether Json.NET includes .NET type names during serialization with a $type property and reads .NET type names from that property to determine what type to create during deserialization.
The value of the $type property can be customized and validated by creating your own SerializationBinder.
2.8 TypeNameAssemblyFormat
控制序列化的时候类型名的写法
参考链接