Skip to main content
Version: 10.6.x

UnityWrapperUtilities Class

This class defines utilities to simplify the process of serializing and deserializing Json. More...

Static Public Member Functions

static string ConvertDictionaryOfStringsToJsonString (Dictionary< string, string > dictionaryOfStrings)
 This method creates a Json string representation of a dictionary of strings. More...
 
static string ConvertDictionaryToJsonString< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
 Generic method that creates a Json string representation of a dictionary with any type. More...
 
static string ConvertArrayOfStringsToJsonString (List< string > listOfStrings)
 This method creates a Json string representation of a list of strings. More...
 
static string ConvertObjectToJsonString (System.Object objectToSerialize)
 This method creates a Json string representation of an object. More...
 
static TKey[] GetDictionaryKeysAsArray< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
 This method returns the keys of a dictionary as an array. More...
 
static TValue[] GetDictionaryValuesAsArray< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
 This method returns the values of a dictionary as an array. More...
 
static Dictionary< TKey, TValue > GetDictionaryFromKeyValueArrays< TKey, TValue > (TKey[] keys, TValue[] values)
 This method constructs a dictionary from an array of keys and an array of values. More...
 
static Dictionary< string, string > ConvertJsonToDictionary (string json)
 This method deserializes a Json string into a flat dictionary. More...
 
static Dictionary< string, object > ConvertJsonToNestedDictionary (string json)
 This method deserializes a Json string into a nested dictionary. More...
 
static string DecryptBase64Json (string base64String)
 This method decrypts a string in base 64 format. More...
 

Detailed Description

This class defines utilities to simplify the process of serializing and deserializing Json.

Member Function Documentation

◆ ConvertArrayOfStringsToJsonString()

static string BFGSDK.UnityWrapperUtilities.ConvertArrayOfStringsToJsonString (List< string > listOfStrings)
inlinestatic
This method creates a Json string representation of a list of strings.
Parameters
listOfStringsA list of strings.
Returns
A Json representation of the given list.

◆ ConvertDictionaryOfStringsToJsonString()

static string BFGSDK.UnityWrapperUtilities.ConvertDictionaryOfStringsToJsonString (Dictionary< string, string > dictionaryOfStrings)
inlinestatic
This method creates a Json string representation of a dictionary of strings.
Parameters
dictionaryOfStringsA dictionary with keys and values as strings.
Returns
A Json string representing the given dictionary.

◆ ConvertDictionaryToJsonString< TKey, TValue >()

static string BFGSDK.UnityWrapperUtilities.ConvertDictionaryToJsonString< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
inlinestatic
Generic method that creates a Json string representation of a dictionary with any type.
Template Parameters
TKeyThe type for the key entries of the dictionary.
TValueThe type for the value entries of the dictionary.
Parameters
genericDictionaryA dictionary with generic keys and values.
Returns
A Json string representation of the given dictionary.

◆ ConvertJsonToDictionary()

static Dictionary< string, string > BFGSDK.UnityWrapperUtilities.ConvertJsonToDictionary (string json)
inlinestatic
This method deserializes a Json string into a flat dictionary.
Parameters
jsonA Json string to be deserialized that contains a flat dictionary structure of keys and values.
Returns
A dictionary created from the given Json string.

◆ ConvertJsonToNestedDictionary()

static Dictionary< string, object > BFGSDK.UnityWrapperUtilities.ConvertJsonToNestedDictionary (string json)
inlinestatic
This method deserializes a Json string into a nested dictionary.
Parameters
jsonA Json string to be deserialized that contains a complex dictionary structure with nested dictionaries.
Returns
A dictionary created from the given Json string.

◆ ConvertObjectToJsonString()

static string BFGSDK.UnityWrapperUtilities.ConvertObjectToJsonString (System.Object objectToSerialize)
inlinestatic
This method creates a Json string representation of an object.
Parameters
objectToSerializeThe object to be serialized.
Returns
A Json string representation of the given object.

◆ DecryptBase64Json()

static string BFGSDK.UnityWrapperUtilities.DecryptBase64Json (string base64String)
inlinestatic
This method decrypts a string in base 64 format.
Parameters
base64StringA string encripted in base 64 format.
Returns
The decrypted string obtained from the given base 64 string.

◆ GetDictionaryFromKeyValueArrays< TKey, TValue >()

static Dictionary< TKey, TValue > BFGSDK.UnityWrapperUtilities.GetDictionaryFromKeyValueArrays< TKey, TValue > (TKey[] keys,
TValue[] values 
)
inlinestatic
This method constructs a dictionary from an array of keys and an array of values.
Template Parameters
TKeyGeneric type of the keys.
TValueGeneric type of the values.
Parameters
keysAn array of keys.
valuesAn array of values.
Returns
A dictionary created from the keys and values given arrays.

◆ GetDictionaryKeysAsArray< TKey, TValue >()

static TKey[] BFGSDK.UnityWrapperUtilities.GetDictionaryKeysAsArray< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
inlinestatic
This method returns the keys of a dictionary as an array.
Template Parameters
TKeyGeneric type for the keys of the dictionary.
TValueGeneric type for the values of the dictionary.
Parameters
genericDictionaryA dictionary with generic keys and values.
Returns
An array containing the keys of a dictionary.

◆ GetDictionaryValuesAsArray< TKey, TValue >()

static TValue[] BFGSDK.UnityWrapperUtilities.GetDictionaryValuesAsArray< TKey, TValue > (Dictionary< TKey, TValue > genericDictionary)
inlinestatic
This method returns the values of a dictionary as an array.
Template Parameters
TKeyGeneric type for the keys of the dictionary.
TValueGeneric type for the values of the dictionary.
Parameters
genericDictionaryA dictionary with generic keys and values.
Returns
An array containing the values of a dictionary.