Helper for JSON operations. Extends https://www.newtonsoft.com/json.
More...
|
static bool | SerializeToFile (object obj, string path, JsonSerializerSettings? settings=null) |
| Serialize an object to an JSON-file.
|
|
static async Task< bool > | SerializeToFileAsync (object obj, string path, JsonSerializerSettings? settings=null) |
| Serialize an object to an JSON-file asynchronously.
|
|
static string | SerializeToString (object obj, JsonSerializerSettings? settings=null) |
| Serialize an object to an JSON-string.
|
|
static byte[] | SerializeToByteArray (object obj, JsonSerializerSettings? settings=null) |
| Serialize an object to an JSON byte-array.
|
|
static T | DeserializeFromFile< T > (string path, JsonSerializerSettings? settings=null) |
| Deserialize a JSON-file to an object.
|
|
static async Task< T > | DeserializeFromFileAsync< T > (string path, JsonSerializerSettings? settings=null) |
| Deserialize a JSON-file to an object asynchronously.
|
|
static T | DeserializeFromString< T > (string jsonAsString, JsonSerializerSettings? settings=null) |
| Deserialize a JSON-string to an object.
|
|
static T | DeserializeFromByteArray< T > (byte[] data, JsonSerializerSettings? settings=null) |
| Deserialize a JSON byte-array to an object.
|
|
|
static JsonSerializerSettings | FORMAT_NONE [get] |
| Format for JSON as single line.
|
|
static JsonSerializerSettings | FORMAT_INDENTED [get] |
| Format for indented JSON.
|
|
Helper for JSON operations. Extends https://www.newtonsoft.com/json.
◆ DeserializeFromByteArray< T >()
static T BogaNet.Helper.JsonHelper.DeserializeFromByteArray< T > |
( |
byte[] | data, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Deserialize a JSON byte-array to an object.
- Parameters
-
data | JSON of the object as byte-array |
settings | Serializer settings (optional) |
- Returns
- Object
- Exceptions
-
◆ DeserializeFromFile< T >()
static T BogaNet.Helper.JsonHelper.DeserializeFromFile< T > |
( |
string | path, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Deserialize a JSON-file to an object.
- Parameters
-
path | JSON-file of the object |
settings | Serializer settings (optional) |
- Returns
- Object
- Exceptions
-
◆ DeserializeFromFileAsync< T >()
static async Task< T > BogaNet.Helper.JsonHelper.DeserializeFromFileAsync< T > |
( |
string | path, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Deserialize a JSON-file to an object asynchronously.
- Parameters
-
path | JSON-file of the object |
settings | Serializer settings (optional) |
- Returns
- Object
- Exceptions
-
◆ DeserializeFromString< T >()
static T BogaNet.Helper.JsonHelper.DeserializeFromString< T > |
( |
string | jsonAsString, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Deserialize a JSON-string to an object.
- Parameters
-
jsonAsString | JSON of the object as string |
settings | Serializer settings (optional) |
- Returns
- Object
- Exceptions
-
◆ SerializeToByteArray()
static byte[] BogaNet.Helper.JsonHelper.SerializeToByteArray |
( |
object | obj, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Serialize an object to an JSON byte-array.
- Parameters
-
obj | Object to serialize |
settings | Serializer settings (optional) |
- Returns
- Object as JSON byte-array
- Exceptions
-
◆ SerializeToFile()
static bool BogaNet.Helper.JsonHelper.SerializeToFile |
( |
object | obj, |
|
|
string | path, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Serialize an object to an JSON-file.
- Parameters
-
obj | Object to serialize |
path | File name of the JSON |
settings | Serializer settings (optional) |
- Returns
- True if the operation was successful
- Exceptions
-
◆ SerializeToFileAsync()
static async Task< bool > BogaNet.Helper.JsonHelper.SerializeToFileAsync |
( |
object | obj, |
|
|
string | path, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Serialize an object to an JSON-file asynchronously.
- Parameters
-
obj | Object to serialize |
path | File name of the JSON |
settings | Serializer settings (optional) |
- Returns
- True if the operation was successful
- Exceptions
-
◆ SerializeToString()
static string BogaNet.Helper.JsonHelper.SerializeToString |
( |
object | obj, |
|
|
JsonSerializerSettings? | settings = null ) |
|
static |
Serialize an object to an JSON-string.
- Parameters
-
obj | Object to serialize |
settings | Serializer settings (optional) |
- Returns
- Object as JSON-string
- Exceptions
-
◆ FORMAT_INDENTED
JsonSerializerSettings BogaNet.Helper.JsonHelper.FORMAT_INDENTED |
|
staticget |
Format for indented JSON.
◆ FORMAT_NONE
JsonSerializerSettings BogaNet.Helper.JsonHelper.FORMAT_NONE |
|
staticget |
Format for JSON as single line.
The documentation for this class was generated from the following file:
- /Users/stefanlaubenberger/Projects/CSharp/BogaNet/BogaNet.Common/Helper/JsonHelper.cs