Class EncodingJsonConverter
- Namespace
- DatabentoDotNet.Historical.Json
- Assembly
- DatabentoDotNet.Historical.dll
Reads and writes Encoding as the codec's wire string.
public sealed class EncodingJsonConverter : JsonConverter<Encoding>
- Inheritance
-
EncodingJsonConverter
- Inherited Members
Remarks
Needed by Encoding and by nothing else in this library: every other
request hard-codes dbn and no other response carries the field. A batch job is the one
place a caller chooses, so it is the one place the choice comes back.
dbz — the pre-rename file extension — parses as Dbn and is never
written, which is TryParseEncoding(string?, out Encoding)'s behaviour rather than this
converter's.
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type Encoding.
public override Encoding Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- Encoding
The converted value.
Write(Utf8JsonWriter, Encoding, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, Encoding value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueEncodingThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.