Class JsonSerializer
JSON serializer.
Inheritance
System.Object
JsonSerializer
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: Kephas.Serialization.Json
Assembly: Kephas.Serialization.Json.dll
Syntax
[OverridePriority(Priority.Low)]
public class JsonSerializer : ISerializer<JsonMediaType>, ISerializer, ISyncSerializer
Constructors
| Improve this Doc View SourceJsonSerializer(IJsonSerializerSettingsProvider)
Initializes a new instance of the JsonSerializer class.
Declaration
public JsonSerializer(IJsonSerializerSettingsProvider settingsProvider = null)
Parameters
Type | Name | Description |
---|---|---|
IJsonSerializerSettingsProvider | settingsProvider | The settings provider. |
Methods
| Improve this Doc View SourceDeserialize(TextReader, ISerializationContext)
Deserializes an object.
Declaration
public object Deserialize(TextReader textReader, ISerializationContext context = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | textReader | The System.IO.TextReader containing the serialized object. |
ISerializationContext | context | The context. |
Returns
Type | Description |
---|---|
System.Object | The deserialized object. |
DeserializeAsync(TextReader, ISerializationContext, CancellationToken)
Deserialize an object asynchronously.
Declaration
public Task<object> DeserializeAsync(TextReader textReader, ISerializationContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextReader | textReader | The System.IO.TextReader containing the serialized object. |
ISerializationContext | context | The context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | A Task promising the deserialized object. |
Serialize(Object, TextWriter, ISerializationContext)
Serializes the provided object.
Declaration
public void Serialize(object obj, TextWriter textWriter, ISerializationContext context = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object. |
System.IO.TextWriter | textWriter | The System.IO.TextWriter used to write the object content. |
ISerializationContext | context | The context. |
SerializeAsync(Object, TextWriter, ISerializationContext, CancellationToken)
Serializes the provided object asynchronously.
Declaration
public Task SerializeAsync(object obj, TextWriter textWriter, ISerializationContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object. |
System.IO.TextWriter | textWriter | The System.IO.TextWriter used to write the object content. |
ISerializationContext | context | The context. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A Task promising the serialized object as a string. |