Class NewtonsoftJsonFormatter
- 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
options
NewtonsoftJsonFormatterOptionsThe configured NewtonsoftJsonFormatterOptions.
NewtonsoftJsonFormatter(Action<NewtonsoftJsonFormatterOptions>)
Initializes a new instance of the NewtonsoftJsonFormatter class.
public NewtonsoftJsonFormatter(Action<NewtonsoftJsonFormatterOptions> setup)
Parameters
setup
Action<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
value
StreamThe string from which to deserialize the object graph.
objectType
TypeThe 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
source
ObjectThe object to serialize to JSON format.
objectType
TypeThe type of the object to serialize.
Returns
- Stream
A string of the serialized
source
.
See Also
StreamFormatter<TOptions>
JsonConverter