Table of Contents

Class LatLngConverter

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

Custom JSON converter for the LatLng struct.

public class LatLngConverter : JsonConverter<LatLng>
Inheritance
LatLngConverter
Inherited Members

Remarks

This converter handles serialization and deserialization of LatLng values to and from JSON arrays of two floating-point numbers representing [latitude, longitude]. For example: [37.8280722, -122.4981393]

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON array to a LatLng value.

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

LatLng

The deserialized LatLng value.

Write(Utf8JsonWriter, LatLng, JsonSerializerOptions)

Writes the LatLng value as a JSON array.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value LatLng

The LatLng value to write.

options JsonSerializerOptions

The serializer options.