Table of Contents

Class TokenResponseConverter

Namespace
Visus.AddressValidation.Serialization.Json
Assembly
Visus.AddressValidation.dll

Converts a TokenResponse object to and from JSON.

public sealed class TokenResponseConverter : JsonConverter<TokenResponse>
Inheritance
TokenResponseConverter
Inherited Members

Remarks

This converter handles both snake_case JSON property names (e.g. access_token) and PascalCase property names (e.g. AccessToken). The ExpiresIn field accepts either a JSON number or a numeric string.

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts JSON into a TokenResponse object.

[SuppressMessage("Design", "MA0051:Method is too long", Justification = "Necessary to properly handle all properties in a single pass through the JSON data.")]
public override TokenResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

The reader to read JSON from.

typeToConvert Type

The type to convert. Must be TokenResponse.

options JsonSerializerOptions

The serializer options to use during deserialization.

Returns

TokenResponse

A TokenResponse populated from the JSON data.

Write(Utf8JsonWriter, TokenResponse?, JsonSerializerOptions)

Writes a TokenResponse object as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write JSON to.

value TokenResponse

The TokenResponse value to serialize. May be null.

options JsonSerializerOptions

The serializer options to use during serialization.

Exceptions

ArgumentNullException

Thrown when writer is null.