Class SimpleJsonSerializer
This defines the default way how Json is de-/serialized.
Inheritance
System.Object
SimpleJsonSerializer
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Dapplo.HttpExtensions.JsonSimple
Assembly: Dapplo.HttpExtensions.JsonSimple.dll
Syntax
public class SimpleJsonSerializer : IJsonSerializer
Methods
| Improve this Doc View SourceCanDeserializeFrom(Type)
Test if the specified type can be deserialized
Declaration
public bool CanDeserializeFrom(Type targetType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | targetType | Type to check |
Returns
Type | Description |
---|---|
System.Boolean | bool |
CanSerializeTo(Type)
Test if the specified type can be serialized to JSON
Declaration
public bool CanSerializeTo(Type sourceType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | sourceType | Type to check |
Returns
Type | Description |
---|---|
System.Boolean | bool |
Deserialize(Type, String)
Declaration
public object Deserialize(Type targetType, string jsonString)
Parameters
Type | Name | Description |
---|---|---|
System.Type | targetType | Type to deserialize from a json string |
System.String | jsonString | json |
Returns
Type | Description |
---|---|
System.Object | Deserialized json as targetType |
RegisterGlobally(Boolean)
Register this IJsonSerializer globally
Declaration
public static void RegisterGlobally(bool force = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | force | bool to specify if this also needs to be set when another serializer is already specified |
Serialize<TContent>(TContent)
Declaration
public string Serialize<TContent>(TContent jsonObject)
Parameters
Type | Name | Description |
---|---|---|
TContent | jsonObject | The actual object |
Returns
Type | Description |
---|---|
System.String | string with json |
Type Parameters
Name | Description |
---|---|
TContent | Type to serialize to json string |