Class NewtonsoftJsonFormatter
- Namespace
- Codebelt.Extensions.Newtonsoft.Json.Formatters
- Assembly
- Codebelt.Extensions.Newtonsoft.Json.dll
Serializes and deserializes an object, in JSON format.
public class NewtonsoftJsonFormatter : StreamFormatter<NewtonsoftJsonFormatterOptions>, IConfigurable<NewtonsoftJsonFormatterOptions>
- Inheritance
-
NewtonsoftJsonFormatter
- Implements
- Inherited Members
Constructors
NewtonsoftJsonFormatter()
Initializes a new instance of the NewtonsoftJsonFormatter class.
public NewtonsoftJsonFormatter()
NewtonsoftJsonFormatter(NewtonsoftJsonFormatterOptions)
Initializes a new instance of the NewtonsoftJsonFormatter class.
public NewtonsoftJsonFormatter(NewtonsoftJsonFormatterOptions options)
Parameters
optionsNewtonsoftJsonFormatterOptionsThe configured NewtonsoftJsonFormatterOptions.
NewtonsoftJsonFormatter(Action<NewtonsoftJsonFormatterOptions>)
Initializes a new instance of the NewtonsoftJsonFormatter class.
public NewtonsoftJsonFormatter(Action<NewtonsoftJsonFormatterOptions> setup)
Parameters
setupAction<NewtonsoftJsonFormatterOptions>The NewtonsoftJsonFormatterOptions which need to be configured.
Methods
Deserialize(Stream, Type)
Deserializes the specified value into an object of objectType.
public override object Deserialize(Stream value, Type objectType)
Parameters
valueStreamThe string from which to deserialize the object graph.
objectTypeTypeThe type of the deserialized object.
Returns
- object
An object of
objectType.
Serialize(object, Type)
Serializes the specified source to an object of Stream.
public override Stream Serialize(object source, Type objectType)
Parameters
sourceobjectThe object to serialize to JSON format.
objectTypeTypeThe type of the object to serialize.
Returns
- Stream
A string of the serialized
source.
See Also
StreamFormatter<TOptions>
JsonConverter