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
readerUtf8JsonReaderThe reader to read from.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsThe serializer options.
Returns
Write(Utf8JsonWriter, LatLng, JsonSerializerOptions)
Writes the LatLng value as a JSON array.
public override void Write(Utf8JsonWriter writer, LatLng value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueLatLngThe LatLng value to write.
optionsJsonSerializerOptionsThe serializer options.