Table of Contents

Class OmieFlexibleStringConverter

Namespace
NuvTools.Payment.Omie.ApiClient.Json
Assembly
NuvTools.Payment.Omie.ApiClient.dll

Reads as text a field Omie may send as text or as a number. Status codes and the NFS-e number are documented as string, but arrive sometimes as "0" and sometimes as 0 depending on the call — and a JsonException here would bring down the whole response read over one field's formatting.

public sealed class OmieFlexibleStringConverter : JsonConverter<string?>
Inheritance
OmieFlexibleStringConverter
Inherited Members

Methods

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type string.

public override string? 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

string

The converted value.

Write(Utf8JsonWriter, string?, JsonSerializerOptions)

Writes a specified value as JSON.

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

Parameters

writer Utf8JsonWriter

The writer to write to.

value string

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.