Class JsonDataSerializer
DataSerializer to serialize to Json and deserialize from Json
Inherited Members
Namespace: UnityEngine.GameFoundation.DataPersistence
Syntax
public sealed class JsonDataSerializer : DataSerializerBase, IDataSerializer
Constructors
JsonDataSerializer()
Default constructor of the Json DataSerialzier
Declaration
public JsonDataSerializer()
Methods
Deserialize(String, Type, Boolean)
Json deserialzation method that deserialize the data from a string as the type T and return it as an object. Can use encryption.
Declaration
public override object Deserialize(string data, Type t, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | The data to deserialize as a string |
| System.Type | t | The type of the data to be deserialized |
| System.Boolean | encrypted | Is the deserialization encrypted |
Returns
| Type | Description |
|---|---|
| System.Object | The deserialized data as an object |
Overrides
Deserialize<T>(Byte[], Boolean)
This method is not implemented yet. Json deserialization method that deserialize the data from a byte array and return it as the type T. Can use encryption.
Declaration
public override T Deserialize<T>(byte[] data, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | data | The data to deserialize as a byte array |
| System.Boolean | encrypted | Is the deserialization encrypted |
Returns
| Type | Description |
|---|---|
| T | The deserialized data as type T |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the data to be deserialized |
Overrides
Deserialize<T>(Stream, Boolean)
Json deserialization method that deserialize the data from a stream and return it as the type T. Can use encryption.
Declaration
public override T Deserialize<T>(Stream stream, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream to deserialize |
| System.Boolean | encrypted | Is the deserialization encrypted |
Returns
| Type | Description |
|---|---|
| T | The deserialized data as type T |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the data to be deserialized |
Overrides
Deserialize<T>(String, Boolean)
Json deserialization method that deserialize the data from a string and return it as the type T. Can use encryption.
Declaration
public override T Deserialize<T>(string data, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | The data to deserialize as a string |
| System.Boolean | encrypted | Is the deserialization encrypted |
Returns
| Type | Description |
|---|---|
| T | The deserialized data as type T |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the data to be deserialized |
Overrides
Serialize(Object)
Json serialization method that serialize a data object and return the data as object.
Declaration
public override object Serialize(object data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | data | The data object to serialize |
Returns
| Type | Description |
|---|---|
| System.Object | The serialized data as an object |
Overrides
Serialize(Object, Boolean)
Json serialization method that serialize a data object and return the data as string. Can use encryption.
Declaration
public override string Serialize(object data, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | data | The data object to serialize |
| System.Boolean | encrypted | Is the serialization encrypted |
Returns
| Type | Description |
|---|---|
| System.String | The serialized data as an string |
Overrides
Serialize<T>(T, Boolean)
Json serialization method that serialize the data of a generic type T and return the data as string. Can use encryption.
Declaration
public override string Serialize<T>(T data, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| T | data | The data as type T to serialize |
| System.Boolean | encrypted | Is the serialization encrypted |
Returns
| Type | Description |
|---|---|
| System.String | The serialized data as an string |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the data to be serialized |
Overrides
Serialize<T>(T, Stream, Boolean)
Json serialization method that serialize the data of a generic type T and write the data through a stream. Can use encryption.
Declaration
public override void Serialize<T>(T data, Stream stream, bool encrypted = false)
Parameters
| Type | Name | Description |
|---|---|---|
| T | data | The data as type T to serialize |
| System.IO.Stream | stream | The stream through which the serialization is supposed to be written |
| System.Boolean | encrypted | Is the serialization encrypted |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the data to be serialized |