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
true
if 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
true
if 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
objectType
TypeType of the object.
Returns
- bool
true
if 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
reader
JsonReaderThe JsonReader to read from.
objectType
TypeType of the object.
existingValue
objectThe existing value of object being read.
serializer
JsonSerializerThe 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
writer
JsonWriterThe JsonWriter to write to.
value
objectThe value.
serializer
JsonSerializerThe calling serializer.