Class PreservingNullableJsonElementConverter
Preserves the distinction between absent data and an explicit JSON null.
public sealed class PreservingNullableJsonElementConverter : JsonConverter<JsonElement?>
- Inheritance
-
objectJsonConverterJsonConverter<JsonElement?>PreservingNullableJsonElementConverter
Properties
HandleNull
Gets a value that indicates whether null should be passed to the converter on serialization, and whether System.Text.Json.JsonTokenType.Null should be passed on deserialization.
public override bool HandleNull { get; }
Property Value
- bool
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type System.Text.Json.JsonElement?.
public override JsonElement? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- JsonElement?
The converted value.
Write(Utf8JsonWriter, JsonElement?, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, JsonElement? value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueJsonElement?The value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.