JArrayToObjectConverter

Ecng.Serialization

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

Hereda de: JsonConverter

Propiedades

CanWrite
public override bool CanWrite { get; }
value = jArrayToObjectConverter.CanWrite

Gets a value indicating whether this converter can write JSON.

Métodos

CanConvert
public override bool CanConvert(Type objectType)
result = jArrayToObjectConverter.CanConvert(objectType)

Determines whether this converter can convert the specified object type.

objectType
Type of the object.

Devuelve: Always returns true.

ReadJson
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
result = jArrayToObjectConverter.ReadJson(reader, objectType, existingValue, serializer)

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

reader
The JSON reader.
objectType
Type of the object.
existingValue
The existing value of the object being populated.
serializer
The JSON serializer.

Devuelve: The deserialized object with fields set from the JSON array.

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

Writes the object as a JSON array, mapping fields in declaration order.

writer
The JSON writer.
value
The object value.
serializer
The JSON serializer.