Class CoreJson
A static helper class that serializes and deserializes JSON with the Artemis Core JSON settings
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public static class CoreJson
Methods
DeserializeObject(string, bool)
Deserializes the JSON to a .NET object.
Declaration
public static object? DeserializeObject(string value, bool handleTypeNames = false)
Parameters
Type | Name | Description |
---|---|---|
string | value | The JSON to deserialize. |
bool | handleTypeNames | If set to true sets TypeNameHandling to Newtonsoft.Json.TypeNameHandling.All |
Returns
Type | Description |
---|---|
object | The deserialized object from the JSON string. |
DeserializeObject(string, Type, bool)
Deserializes the JSON to the specified .NET type.
Declaration
public static object? DeserializeObject(string value, Type type, bool handleTypeNames = false)
Parameters
Type | Name | Description |
---|---|---|
string | value | The JSON to deserialize. |
Type | type | The Type of object being deserialized. |
bool | handleTypeNames | If set to true sets TypeNameHandling to Newtonsoft.Json.TypeNameHandling.All |
Returns
Type | Description |
---|---|
object | The deserialized object from the JSON string. |
DeserializeObject<T>(string, bool)
Deserializes the JSON to the specified .NET type.
Declaration
public static T DeserializeObject<T>(string value, bool handleTypeNames = false)
Parameters
Type | Name | Description |
---|---|---|
string | value | The JSON to deserialize. |
bool | handleTypeNames | If set to true sets TypeNameHandling to Newtonsoft.Json.TypeNameHandling.All |
Returns
Type | Description |
---|---|
T | The deserialized object from the JSON string. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to deserialize to. |
SerializeObject(object?, bool)
Serializes the specified object to a JSON string.
Declaration
public static string SerializeObject(object? value, bool handleTypeNames = false)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object to serialize. |
bool | handleTypeNames | If set to true sets TypeNameHandling to Newtonsoft.Json.TypeNameHandling.All |
Returns
Type | Description |
---|---|
string | A JSON string representation of the object. |