Table of Contents

Class FrameTypesConverter

Namespace
Tudormobile.Strava.Converters
Assembly
Tudormobile.Strava.dll

Custom JSON converter for the FrameTypes enum.

public class FrameTypesConverter : JsonConverter<FrameTypes>
Inheritance
FrameTypesConverter
Inherited Members

Remarks

This converter handles serialization and deserialization of FrameTypes enum values to and from JSON. It supports both numeric (integer) and string representations of the enum values. The Strava API typically returns frame_type as a string (e.g., "Road", "Mountain").

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to a FrameTypes value. Handles both numeric and string representations of the enum.

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

Parameters

reader Utf8JsonReader

The reader to read from.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

The serializer options.

Returns

FrameTypes

The deserialized FrameTypes value.

Write(Utf8JsonWriter, FrameTypes, JsonSerializerOptions)

Writes the FrameTypes value as a numeric value to JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value FrameTypes

The FrameTypes value to write.

options JsonSerializerOptions

The serializer options.