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
TypeType 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
JsonReaderThe JSON reader.
objectType
TypeType of the object.
existingValue
objectThe existing value of the object being populated.
serializer
JsonSerializerThe 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
JsonWriterThe JSON writer.
value
objectThe object value.
serializer
JsonSerializerThe JSON serializer.
Exceptions
- NotSupportedException
Always thrown because writing is not supported.