Class JsonExtensions
Provides methods for returning a list of element from a json file or write a list into a json file.
Namespace: Global Namespace
Syntax
public static class JsonExtensions
Methods
FromJsonList<T>(String)
Convert a json formated list into a c# list.
Declaration
public static List<T> FromJsonList<T>(string json)
Parameters
Type | Name | Description |
---|---|---|
String | json | json string containing a list of elements. |
Returns
Type | Description |
---|---|
List<T> | The C# list containing elements coming from the json list. |
Type Parameters
Name | Description |
---|---|
T | Type of the element in the list. |
ListToJson<T>(List<T>, Boolean)
Convert a c# list into a json list
Declaration
public static string ListToJson<T>(List<T> list, bool pretty = false)
Parameters
Type | Name | Description |
---|---|---|
List<T> | list | C# list of elements |
Boolean | pretty | Make the json string human readable(true) or pack as much as possible(false). |
Returns
Type | Description |
---|---|
String | A json list containing elements coming from the C# list. |
Type Parameters
Name | Description |
---|---|
T | Type of the element in the list. |