Class JsonMarshaller
- Namespace
- Savvyio.Extensions.Text.Json
- Assembly
- Savvyio.Extensions.Text.Json.dll
Provides a class for marshalling data using native JSON support in .NET.
public class JsonMarshaller : IMarshaller
- Inheritance
-
JsonMarshaller
- Implements
Constructors
JsonMarshaller(Action<JsonFormatterOptions>)
Initializes a new instance of the JsonMarshaller class.
public JsonMarshaller(Action<JsonFormatterOptions> setup = null)
Parameters
setupAction<JsonFormatterOptions>The JsonFormatterOptions which may be configured.
Properties
Default
Provides a default instance of the JsonMarshaller class optimized for messaging.
public static JsonMarshaller Default { get; }
Property Value
- JsonMarshaller
The default instance of the JsonMarshaller class optimized for messaging.
Methods
Create(Action<JsonFormatterOptions>)
Creates a new instance of the JsonMarshaller class.
public static JsonMarshaller Create(Action<JsonFormatterOptions> setup = null)
Parameters
setupAction<JsonFormatterOptions>The JsonFormatterOptions which may be configured.
Returns
- JsonMarshaller
JsonMarshaller.
Deserialize(Stream, Type)
Deserializes the specified data into an object of returnType.
public object Deserialize(Stream data, Type returnType)
Parameters
dataStreamThe string from which to deserialize the object graph.
returnTypeTypeThe type of the deserialized object.
Returns
- object
An object of
returnType.
Deserialize<TValue>(Stream)
Deserializes the specified data into an object of TValue.
public TValue Deserialize<TValue>(Stream data)
Parameters
dataStreamThe object from which to deserialize the object graph.
Returns
- TValue
An object of
TValue.
Type Parameters
TValueThe type of the object to return.
Serialize(object, Type)
Serializes the specified value to an object of Stream.
public Stream Serialize(object value, Type inputType)
Parameters
valueobjectThe object to serialize to Stream format.
inputTypeTypeThe type of the object to serialize.
Returns
Serialize<TValue>(TValue)
Serializes the specified value to an object of Stream.
public Stream Serialize<TValue>(TValue value)
Parameters
valueTValueThe object to serialize to Stream format.
Returns
Type Parameters
TValue