Class JsonDictionaryUtility
Inheritance
object
JsonDictionaryUtility
Namespace: i5.Toolkit.Core.Utilities
Assembly: cs.temp.dll.dll
Syntax
public static class JsonDictionaryUtility
Methods
FromJson<K, V>(string)
Deserializes a JSON string to a dictionary
Declaration
public static Dictionary<K, V> FromJson<K, V>(string json)
Parameters
Type | Name | Description |
---|---|---|
string | json | The json string which should be parsed |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<TKey, TValue><K, V> | Returns the deserialized dictionary |
Type Parameters
Name | Description |
---|---|
K | The type of the dictionary's keys |
V | The type of the dictionary's values |
ToJson<K, V>(Dictionary<K, V>, bool)
Serializes a dictionary to a JSON string
Declaration
public static string ToJson<K, V>(Dictionary<K, V> dict, bool prettyPrint = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<TKey, TValue><K, V> | dict | The dictionary which should be serialized |
bool | prettyPrint | If true, the JSON string will be formatted to be better human-readable |
Returns
Type | Description |
---|---|
string | Returns the serialized JSON string |
Type Parameters
Name | Description |
---|---|
K | The type of the dictionary's keys |
V | The type of the dictionary's values |