PortableTypeJsonConverter
JSON converter for PortableType discriminated union.
public sealed class PortableTypeJsonConverter : JsonConverter<PortableType>
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
public override PortableType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Reads and converts the JSON to type ``.
Parameters:
| Name | Type | Description |
|---|---|---|
reader |
Utf8JsonReader |
The reader. |
typeToConvert |
Type |
The type to convert. |
options |
JsonSerializerOptions |
An object that specifies serialization options to use. |
Returns: PortableType - The converted value.
Write(Utf8JsonWriter, PortableType, JsonSerializerOptions)
public override void Write(Utf8JsonWriter writer, PortableType value, JsonSerializerOptions options)
Writes a specified value as JSON.
Parameters:
| Name | Type | Description |
|---|---|---|
writer |
Utf8JsonWriter |
The writer to write to. |
value |
PortableType |
The value to convert to JSON. |
options |
JsonSerializerOptions |
An object that specifies serialization options to use. |