Interface IJsonSerializer
Provides functionality to serialize objects or value types to JSON and to deserialize JSON into objects or value types.
Namespace: Umbraco.Cms.Core.Serialization
Assembly: Umbraco.Core.dll
Syntax
public interface IJsonSerializer
Methods
View SourceDeserialize<T>(String)
Parses the text representing a single JSON value into an instance of the type specified by a generic type parameter.
Declaration
T Deserialize<T>(string input)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The JSON input to parse. |
Returns
Type | Description |
---|---|
T | A |
Type Parameters
Name | Description |
---|---|
T | The target type of the JSON value. |
Serialize(Object)
Converts the specified input
into a JSON string.
Declaration
string Serialize(object input)
Parameters
Type | Name | Description |
---|---|---|
System.Object | input | The input. |
Returns
Type | Description |
---|---|
System.String | A JSON string representation of the value. |
TryDeserialize<T>(Object, out T)
Attempts to parse an object that represents a JSON structure - i.e. a JSON object or a JSON array - to a strongly typed representation.
Declaration
bool TryDeserialize<T>(object input, out T value)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.Object | input | The object input to parse. |
T | value | The parsed result, or null if the parsing fails. |
Returns
Type | Description |
---|---|
System.Boolean | True if the parsing results in a non-null value, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The target type of the JSON value. |