I would like to change the default serialization mode in Json.NET from MemberSerialization.OptOut
to MemberSerialization.Fields
without needing to scatter [JsonObject(MemberSerialization.Fields)]
attributes through every class in my code base.
My primary reasons for wanting this is to get my Json deserializer to not call constructors and to make sure that all fields, including private ones, are correctly serialized and deserialized.
An example of the behaviour I'm looking for would be the serialization / deserialization behaviour of the BinaryFormatter
, except without needing to scatter [Serializable]
attributes through the entire codebase.