JsonConverterBase<T> class

Base class for simple JSON converters.

public abstract class JsonConverterBase<T> : JsonConverter
parameter description
T The type.

Public Members

name description
override CanConvert(…) Implements CanConvert.
override ReadJson(…) Implements ReadJson.
override WriteJson(…) Implements WriteJson.

Protected Members

name description
JsonConverterBase() The default constructor.
abstract ReadCore(…) Reads the JSON representation of the value.
abstract WriteCore(…) Writes the JSON representation of the value.

Remarks

This base class provides strongly-typed abstract methods for reading and writing. The converter only supports type T directly, not derived types. Null is handled automatically for both reading and writing, including support for Nullable{T}. A JsonSerializationException is thrown if null is read for a non-nullable value type. If your converter has more advanced needs, derive from JsonConverter directly.

See Also