Class OptionalConverter<T>
Represents JSON converter for Optional<T> data type.
Inherited Members
Namespace: DotNext.Text.Json
Assembly: DotNext.dll
Syntax
public sealed class OptionalConverter<T> : JsonConverter<Optional<T>>
Type Parameters
Name | Description |
---|---|
T | The type of the value in Optional<T> container. |
Methods
| Edit this page View SourceRead(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type Optional.
Declaration
public override Optional<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
Utf8JsonReader | reader | The reader. |
Type | typeToConvert | The type to convert. |
JsonSerializerOptions | options | An object that specifies serialization options to use. |
Returns
Type | Description |
---|---|
Optional<T> | The converted value. |
Overrides
| Edit this page View SourceWrite(Utf8JsonWriter, Optional<T>, JsonSerializerOptions)
Writes a specified value as JSON.
Declaration
public override void Write(Utf8JsonWriter writer, Optional<T> value, JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
Utf8JsonWriter | writer | The writer to write to. |
Optional<T> | value | The value to convert to JSON. |
JsonSerializerOptions | options | An object that specifies serialization options to use. |