Table of Contents

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 Type

Type 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 JsonReader

The JsonReader to read from.

objectType Type

Type of the object.

existingValue object

The existing value of object being read.

serializer JsonSerializer

The 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 JsonWriter

The JsonWriter to write to.

value object

The value.

serializer JsonSerializer

The calling serializer.