Table of Contents

Class JArrayToObjectConverter

Namespace
Ecng.Serialization
Assembly
Ecng.Serialization.dll

Converts a JSON array to an object by mapping array elements to the object's fields in declaration order.

public class JArrayToObjectConverter : JsonConverter
Inheritance
JArrayToObjectConverter
Extension Methods

Constructors

JArrayToObjectConverter()

public JArrayToObjectConverter()

Properties

CanWrite

Gets a value indicating whether this converter can write JSON.

public override bool CanWrite { get; }

Property Value

bool

Always false because writing is not supported.

Methods

CanConvert(Type)

Determines whether this converter can convert the specified object type.

public override bool CanConvert(Type objectType)

Parameters

objectType Type

Type of the object.

Returns

bool

Always returns true.

ReadJson(JsonReader, Type, object, JsonSerializer)

Reads the JSON representation of the object and maps JSON array elements to object fields.

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)

Parameters

reader JsonReader

The JSON reader.

objectType Type

Type of the object.

existingValue object

The existing value of the object being populated.

serializer JsonSerializer

The JSON serializer.

Returns

object

The deserialized object with fields set from the JSON array.

WriteJson(JsonWriter, object, JsonSerializer)

Not supported. Throws a NotSupportedException.

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)

Parameters

writer JsonWriter

The JSON writer.

value object

The object value.

serializer JsonSerializer

The JSON serializer.

Exceptions

NotSupportedException

Always thrown because writing is not supported.