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 is handled as either a JSON number or a string representation of an integer.

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type TokenResponse.

[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.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An object that specifies serialization options to use.

Returns

TokenResponse

The converted value.

Write(Utf8JsonWriter, TokenResponse?, JsonSerializerOptions)

Writes a specified value as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value TokenResponse

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.

Exceptions

ArgumentNullException

Thrown when writer is null.