Table of Contents

Class LocalDateJsonConverter

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

Reads a LocalDate from the yyyy-MM-dd spelling the historical API uses for calendar dates.

public sealed class LocalDateJsonConverter : JsonConverter<LocalDate>
Inheritance
LocalDateJsonConverter
Inherited Members

Remarks

Upstream's DATE_FORMAT is "[year]-[month]-[day]" (databento-rs/src/historical.rs:184-185), which is exactly Iso. Registering this converter for LocalDate also covers LocalDate?: System.Text.Json unwraps the nullable and hands the non-null case here, answering null itself for a JSON null — which is what last_modified_date carries when a day's condition is Missing (metadata.rs:300-301).

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type LocalDate.

public override LocalDate 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

LocalDate

The converted value.

Write(Utf8JsonWriter, LocalDate, JsonSerializerOptions)

Writes a specified value as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value LocalDate

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.