Class OmieFlexibleStringConverter
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
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn 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
writerUtf8JsonWriterThe writer to write to.
valuestringThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.