Table of Contents

Class CompressionJsonConverter

Namespace
DatabentoDotNet.Historical.Json
Assembly
DatabentoDotNet.Historical.dll

Reads and writes Compression as the codec's wire string, reading JSON null as None.

public sealed class CompressionJsonConverter : JsonConverter<Compression>
Inheritance
CompressionJsonConverter
Inherited Members

Remarks

The null case is upstream's deserialize_compression (batch.rs:768-774), whose comment reads "Handles Compression::None being serialized as null in JSON". #39 confirmed it: a CSV batch job submitted without compression comes back with "compression":null from both batch.list_jobs and batch.get_job_details.

HandleNull is overridden for the reason SplitDurationJsonConverter gives — without it the null branch below is unreachable, and the gap shows up only against a job that used no compression.

Properties

HandleNull

true: a null token is a value here, not an absence.

public override bool HandleNull { get; }

Property Value

bool

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type Compression.

public override Compression Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

Compression

The converted value.

Write(Utf8JsonWriter, Compression, JsonSerializerOptions)

Writes a specified value as JSON.

public override void Write(Utf8JsonWriter writer, Compression value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

The writer to write to.

value Compression

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.