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
objectTypeTypeType 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
readerJsonReaderThe JSON reader.
objectTypeTypeType of the object.
existingValueobjectThe existing value of the object being populated.
serializerJsonSerializerThe 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
writerJsonWriterThe JSON writer.
valueobjectThe object value.
serializerJsonSerializerThe JSON serializer.
Exceptions
- NotSupportedException
Always thrown because writing is not supported.