Extension class to simplify usage of Newtonsoft.Json
More...
|
static string | ToJson< T > (this T obj) |
| Serializes object to JSON string. More...
|
|
static string | ToJson< T > (this T obj, JsonSerializerSettings jsonSerializerSettings) |
| Serializes object to JSON string. More...
|
|
static T | FromJson< T > (this string text) |
| Deserializes JSON string to object. More...
|
|
static T | FromJson< T > (this string text, JsonSerializerSettings jsonSerializerSettings) |
| Deserializes JSON string to object. More...
|
|
static object | FromJson (this string text, Type type) |
| Deserializes JSON string to object. More...
|
|
static object | FromJson (this string text, Type type, JsonSerializerSettings jsonSerializerSettings) |
| Deserializes JSON string to object. More...
|
|
static T | FromJson< T > (this Stream stream) |
| Deserializes stream containing JSON string to object. More...
|
|
static T | FromJson< T > (this Stream stream, JsonSerializerSettings jsonSerializerSettings) |
| Deserializes stream containing JSON string to object. More...
|
|
Extension class to simplify usage of Newtonsoft.Json
◆ FromJson() [1/2]
static object FromJson |
( |
this string |
text, |
|
|
Type |
type |
|
) |
| |
|
inlinestatic |
Deserializes JSON
string to object.
- Parameters
-
type | A type of object to deserialize. |
text | A JSON string. |
- Returns
- A deserialized object.
◆ FromJson() [2/2]
static object FromJson |
( |
this string |
text, |
|
|
Type |
type, |
|
|
JsonSerializerSettings |
jsonSerializerSettings |
|
) |
| |
|
inlinestatic |
Deserializes JSON
string to object.
- Parameters
-
type | A type of object to deserialize. |
text | A JSON string. |
jsonSerializerSettings | A custom serializer settings. |
- Returns
- A deserialized object.
◆ FromJson< T >() [1/4]
static T FromJson< T > |
( |
this Stream |
stream | ) |
|
|
inlinestatic |
Deserializes stream containing JSON
string to object.
- Template Parameters
-
T | A type of object to deserialize. |
- Parameters
-
stream | A stream containing JSON string. |
- Returns
- A deserialized object.
◆ FromJson< T >() [2/4]
static T FromJson< T > |
( |
this Stream |
stream, |
|
|
JsonSerializerSettings |
jsonSerializerSettings |
|
) |
| |
|
inlinestatic |
Deserializes stream containing JSON
string to object.
- Template Parameters
-
T | A type of object to deserialize. |
- Parameters
-
stream | A stream containing JSON string. |
jsonSerializerSettings | A custom serializer settings. |
- Returns
- A deserialized object.
◆ FromJson< T >() [3/4]
static T FromJson< T > |
( |
this string |
text | ) |
|
|
inlinestatic |
Deserializes JSON
string to object.
- Template Parameters
-
T | A type of object to deserialize. |
- Parameters
-
- Returns
- A deserialized object.
◆ FromJson< T >() [4/4]
static T FromJson< T > |
( |
this string |
text, |
|
|
JsonSerializerSettings |
jsonSerializerSettings |
|
) |
| |
|
inlinestatic |
Deserializes JSON
string to object.
- Template Parameters
-
T | A type of object to deserialize. |
- Parameters
-
text | A JSON string. |
jsonSerializerSettings | A custom serializer settings. |
- Returns
- A deserialized object.
◆ ToJson< T >() [1/2]
static string ToJson< T > |
( |
this T |
obj | ) |
|
|
inlinestatic |
Serializes object to JSON
string.
- Template Parameters
-
T | A type of object to serialize. |
- Parameters
-
obj | An object to serialize. |
- Returns
- A
JSON
string representing serialized object.
◆ ToJson< T >() [2/2]
static string ToJson< T > |
( |
this T |
obj, |
|
|
JsonSerializerSettings |
jsonSerializerSettings |
|
) |
| |
|
inlinestatic |
Serializes object to JSON
string.
- Template Parameters
-
T | A type of object to serialize. |
- Parameters
-
obj | An object to serialize. |
jsonSerializerSettings | A custom serializer settings. |
- Returns
- A
JSON
string representing serialized object.
◆ DefaultJsonSerializerSettings
readonly JsonSerializerSettings DefaultJsonSerializerSettings |
|
static |
Initial value:= new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
Converters = new JsonConverter[] { new SizeConverter(), new SizeAndQualityConverter(), new ImageActionConverter() },
NullValueHandling = NullValueHandling.Ignore,
DateFormatString = "yyyyMMddHHmmss"
}
The default serializer settings.
The documentation for this class was generated from the following file: