Class JsonConverter
- Namespace
- Newtonsoft.Json
- Assembly
- Newtonsoft.Json.dll
Converts an object to and from JSON.
public abstract class JsonConverter
- Inheritance
-
JsonConverter
- Derived
- Inherited Members
Constructors
JsonConverter()
protected JsonConverter()
Properties
CanRead
Gets a value indicating whether this JsonConverter can read JSON.
public virtual bool CanRead { get; }
Property Value
- bool
trueif this JsonConverter can read JSON; otherwise,false.
CanWrite
Gets a value indicating whether this JsonConverter can write JSON.
public virtual bool CanWrite { get; }
Property Value
- bool
trueif this JsonConverter can write JSON; otherwise,false.
Methods
CanConvert(Type)
Determines whether this instance can convert the specified object type.
public abstract bool CanConvert(Type objectType)
Parameters
objectTypeTypeType of the object.
Returns
- bool
trueif this instance can convert the specified object type; otherwise,false.
GetSchema()
Gets the JsonSchema of the JSON produced by the JsonConverter.
public virtual JsonSchema GetSchema()
Returns
- JsonSchema
The JsonSchema of the JSON produced by the JsonConverter.
ReadJson(JsonReader, Type, object, JsonSerializer)
Reads the JSON representation of the object.
public abstract object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Parameters
readerJsonReaderThe JsonReader to read from.
objectTypeTypeType of the object.
existingValueobjectThe existing value of object being read.
serializerJsonSerializerThe calling serializer.
Returns
- object
The object value.
WriteJson(JsonWriter, object, JsonSerializer)
Writes the JSON representation of the object.
public abstract void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Parameters
writerJsonWriterThe JsonWriter to write to.
valueobjectThe value.
serializerJsonSerializerThe calling serializer.