Class AlgoApiSerializer
Contains functions for serializing and deserializing Algorand.Unity types
Namespace: Algorand.Unity
Assembly: cs.temp.dll.dll
Syntax
public static class AlgoApiSerializer
Methods
Deserialize<T>(NativeArray<Byte>, ContentType)
Deserializes raw data based on its ContentType
Declaration
public static T Deserialize<T>(NativeArray<byte> bytes, ContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Byte> | bytes | The raw data to deserialize |
ContentType | contentType | The content type of the raw data (Json | MessagePack) |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize to |
Deserialize<T>(Byte[], ContentType)
Deserializes raw data based on its ContentType
Declaration
public static T Deserialize<T>(byte[] bytes, ContentType contentType)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | bytes | The raw data to deserialize |
ContentType | contentType | The content type of the raw data (Json | MessagePack) |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize to |
DeserializeJson<T>(NativeArray<Byte>)
Deserialize JSON encoded as UTF8 bytes
Declaration
public static T DeserializeJson<T>(NativeArray<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Byte> | bytes | UTF8 Bytes that can be decoded into JSON |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize the data into |
DeserializeJson<T>(NativeText)
Deserialize JSON text into an object
Declaration
public static T DeserializeJson<T>(NativeText text)
Parameters
Type | Name | Description |
---|---|---|
NativeText | text | The JSON text |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type of the object that will be deserialized into |
DeserializeJson<T>(Byte[])
Deserialize JSON encoded as UTF8 bytes
Declaration
public static T DeserializeJson<T>(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | bytes | UTF8 Bytes that can be decoded into JSON |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize the data into |
DeserializeJson<T>(String)
Deserialize JSON text into an object
Declaration
public static T DeserializeJson<T>(string text)
Parameters
Type | Name | Description |
---|---|---|
String | text | The JSON text |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type of the object that will be deserialized into |
DeserializeMessagePack<T>(NativeArray<Byte>)
Deserialize messagepack bytes into an object
Declaration
public static T DeserializeMessagePack<T>(NativeArray<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
NativeArray<Byte> | bytes | The messagepack bytes |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type of the object that will be deserialized into |
DeserializeMessagePack<T>(Byte[])
Deserialize messagepack bytes into an object
Declaration
public static T DeserializeMessagePack<T>(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | bytes | The messagepack bytes |
Returns
Type | Description |
---|---|
T | The data deserialized as T |
Type Parameters
Name | Description |
---|---|
T | The type of the object that will be deserialized into |
SerializeJson<T>(T)
Serialize an object into json text
Declaration
public static string SerializeJson<T>(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object to serialize |
Returns
Type | Description |
---|---|
String | json text as a string |
Type Parameters
Name | Description |
---|---|
T | The type of the object that is serialized |
SerializeJson<T>(T, Allocator)
Serialize an object into json text
Declaration
public static NativeText SerializeJson<T>(T obj, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object to serialize |
Allocator | allocator | The allocator to use for the created text of json |
Returns
Type | Description |
---|---|
NativeText | A |
Type Parameters
Name | Description |
---|---|
T | The type of the object that is serialized |
SerializeMessagePack<T>(T)
Serialize an object into messagepack bytes
Declaration
public static byte[] SerializeMessagePack<T>(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object to serialize |
Returns
Type | Description |
---|---|
Byte[] | The message pack message as an array of bytes |
Type Parameters
Name | Description |
---|---|
T | The type of the object that is serialized |
SerializeMessagePack<T>(T, Allocator)
Serialize an object into messagepack bytes
Declaration
public static NativeList<byte> SerializeMessagePack<T>(T obj, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
T | obj | The object to serialize |
Allocator | allocator | The allocator to use for the created list of message pack bytes |
Returns
Type | Description |
---|---|
NativeList<Byte> | A |
Type Parameters
Name | Description |
---|---|
T | The type of the object that is serialized |