Skip to content

DurationJsonConverter

Namespace: Shadop.Archmage.Sdk

Newtonsoft.Json converter for Duration serialization and deserialization.

public class DurationJsonConverter : Newtonsoft.Json.JsonConverter

Inheritance Object → JsonConverter → DurationJsonConverter

public bool CanRead { get; }

Boolean

public bool CanWrite { get; }

Boolean

public DurationJsonConverter()
public bool CanConvert(Type objectType)

objectType Type

Boolean

ReadJson(JsonReader, Type, Object, JsonSerializer)

Section titled “ReadJson(JsonReader, Type, Object, JsonSerializer)”

Deserializes JSON array or null to Duration (null/empty → Duration.Zero).

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

reader JsonReader

objectType Type

existingValue Object

serializer JsonSerializer

Object

T:Newtonsoft.Json.JsonSerializationException
Thrown if JSON format is invalid.

WriteJson(JsonWriter, Object, JsonSerializer)

Section titled “WriteJson(JsonWriter, Object, JsonSerializer)”

Serializes Duration to JSON array or null.

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

writer JsonWriter

value Object

serializer JsonSerializer