#### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils 'index')
### [Abblix\.Utils\.Json](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Json 'Abblix\.Utils\.Json')

## Base64UrlTextEncoderConverter Class

A JSON converter for handling the serialization and deserialization of byte arrays as Base64 URL\-encoded strings\.

```csharp
public class Base64UrlTextEncoderConverter : System.Text.Json.Serialization.JsonConverter<byte[]?>
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → [System\.Text\.Json\.Serialization\.JsonConverter](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter 'System\.Text\.Json\.Serialization\.JsonConverter') → [System\.Text\.Json\.Serialization\.JsonConverter&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1 'System\.Text\.Json\.Serialization\.JsonConverter\`1')[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1 'System\.Text\.Json\.Serialization\.JsonConverter\`1') → Base64UrlTextEncoderConverter
### Methods

## Base64UrlTextEncoderConverter\.Read\(Utf8JsonReader, Type, JsonSerializerOptions\) Method {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions)}

Reads and converts the JSON token to a byte array\.

```csharp
public override byte[]? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options);
```
#### Parameters

###### `reader` [System\.Text\.Json\.Utf8JsonReader](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader 'System\.Text\.Json\.Utf8JsonReader') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).reader}

The reader to read the JSON token from\.

###### `typeToConvert` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).typeToConvert}

The type of object to convert\.

###### `options` [System\.Text\.Json\.JsonSerializerOptions](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions 'System\.Text\.Json\.JsonSerializerOptions') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).options}

Options for the serializer\.

#### Returns
[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')  
A byte array if the token is a string, otherwise null\.

#### Exceptions

[System\.InvalidOperationException](https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception 'System\.InvalidOperationException')  
Thrown if the token is not a string or null\.

[System\.Text\.Json\.JsonException](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonexception 'System\.Text\.Json\.JsonException')  
Thrown if the string is not valid base64url encoding\.

## Base64UrlTextEncoderConverter\.Write\(Utf8JsonWriter, byte\[\], JsonSerializerOptions\) Method {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Write(System.Text.Json.Utf8JsonWriter,byte[],System.Text.Json.JsonSerializerOptions)}

Writes a byte array as a Base64 URL\-encoded string to the JSON writer\.

```csharp
public override void Write(System.Text.Json.Utf8JsonWriter writer, byte[]? value, System.Text.Json.JsonSerializerOptions options);
```
#### Parameters

###### `writer` [System\.Text\.Json\.Utf8JsonWriter](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonwriter 'System\.Text\.Json\.Utf8JsonWriter') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Write(System.Text.Json.Utf8JsonWriter,byte[],System.Text.Json.JsonSerializerOptions).writer}

The writer to write the JSON token to\.

###### `value` [System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Write(System.Text.Json.Utf8JsonWriter,byte[],System.Text.Json.JsonSerializerOptions).value}

The byte array to write\.

###### `options` [System\.Text\.Json\.JsonSerializerOptions](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions 'System\.Text\.Json\.JsonSerializerOptions') {#Abblix.Utils.Json.Base64UrlTextEncoderConverter.Write(System.Text.Json.Utf8JsonWriter,byte[],System.Text.Json.JsonSerializerOptions).options}

Options for the serializer\.
