#### [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')

## TimeSpanSecondsConverter Class

A custom JSON converter for TimeSpan objects that serializes and deserializes them as a number of seconds\.

```csharp
public class TimeSpanSecondsConverter : System.Text.Json.Serialization.JsonConverter<System.TimeSpan>
```

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\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1 'System\.Text\.Json\.Serialization\.JsonConverter\`1') → TimeSpanSecondsConverter
### Methods

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

Reads a JSON number representing the total seconds and converts it to a TimeSpan object\.

```csharp
public override System.TimeSpan 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.TimeSpanSecondsConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).reader}

The reader to read JSON data from\.

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

The type to convert; expected to be TimeSpan\.

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

Options for the serializer\.

#### Returns
[System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')  
A TimeSpan object representing the value read from the JSON\.

## TimeSpanSecondsConverter\.Write\(Utf8JsonWriter, TimeSpan, JsonSerializerOptions\) Method {#Abblix.Utils.Json.TimeSpanSecondsConverter.Write(System.Text.Json.Utf8JsonWriter,System.TimeSpan,System.Text.Json.JsonSerializerOptions)}

Writes a TimeSpan object to JSON as a number representing its total seconds\.

```csharp
public override void Write(System.Text.Json.Utf8JsonWriter writer, System.TimeSpan 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.TimeSpanSecondsConverter.Write(System.Text.Json.Utf8JsonWriter,System.TimeSpan,System.Text.Json.JsonSerializerOptions).writer}

The writer to write JSON data to\.

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

The TimeSpan value 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.TimeSpanSecondsConverter.Write(System.Text.Json.Utf8JsonWriter,System.TimeSpan,System.Text.Json.JsonSerializerOptions).options}

Options for the serializer\.
