# Class SerializationHelper
Namespace: [CapyKit.Helpers](CapyKit.Helpers.md)
Assembly: CapyKit.dll
```csharp
public static class SerializationHelper
```
#### Inheritance
[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[SerializationHelper](CapyKit.Helpers.SerializationHelper.md)
#### Inherited Members
[object.Equals\(object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\)),
[object.Equals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.equals\#system\-object\-equals\(system\-object\-system\-object\)),
[object.GetHashCode\(\)](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone\(\)](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone),
[object.ReferenceEquals\(object?, object?\)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.object.tostring)
#### Extension Methods
[ObjectExtensions.UpdateProperties\(object, object\)](CapyKit.Extensions.ObjectExtensions.md\#CapyKit\_Extensions\_ObjectExtensions\_UpdateProperties\_System\_Object\_System\_Object\_)
## Methods
### Deserialize\(byte\[\]\)
Deserializes an object to a given T type.
```csharp
public static T Deserialize(byte[] bytes)
```
#### Parameters
`bytes` [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
The byte array representing a T object.
#### Returns
T
A T object.
#### Type Parameters
`T`
Generic type parameter.
#### Exceptions
[FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)
Thrown when the format of the byte array is incorrect.
### Deserialize\(Stream\)
Deserializes an object to a given T type.
```csharp
public static T Deserialize(Stream stream)
```
#### Parameters
`stream` [Stream](https://learn.microsoft.com/dotnet/api/system.io.stream)
The steam.
#### Returns
T
A T object.
#### Type Parameters
`T`
Generic type parameter.
#### Exceptions
[FormatException](https://learn.microsoft.com/dotnet/api/system.formatexception)
Thrown when the format of an input is incorrect.
### Deserialize\(string\)
Deserializes a JSON encoded string to the given T.
```csharp
public static T Deserialize(string str)
```
#### Parameters
`str` [string](https://learn.microsoft.com/dotnet/api/system.string)
The JSON encoded string representing a T object.
#### Returns
T
A T object.
#### Type Parameters
`T`
Generic type parameter.
### SerializeToBytes\(object\)
Serializes an object to a byte array.
```csharp
public static byte[] SerializeToBytes(object obj)
```
#### Parameters
`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)
The object.
#### Returns
[byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]
A JSON encoded string.
### SerializeToString\(object\)
Serializes an object to a JSON encoded string.
```csharp
public static string SerializeToString(object obj)
```
#### Parameters
`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)
The object.
#### Returns
[string](https://learn.microsoft.com/dotnet/api/system.string)
A JSON encoded string.