Class JsonFormatter
- Namespace
- Cuemon.Extensions.Text.Json.Formatters
- Assembly
- Cuemon.Extensions.Text.Json.dll
Serializes and deserializes an object, in JSON format.
public class JsonFormatter : StreamFormatter<JsonFormatterOptions>, IConfigurable<JsonFormatterOptions>
- Inheritance
-
JsonFormatter
- Implements
- Inherited Members
- Extension Methods
Constructors
JsonFormatter()
Initializes a new instance of the JsonFormatter class.
public JsonFormatter()
JsonFormatter(JsonFormatterOptions)
Initializes a new instance of the JsonFormatter class.
public JsonFormatter(JsonFormatterOptions options)
Parameters
optionsJsonFormatterOptionsThe configured JsonFormatterOptions.
JsonFormatter(Action<JsonFormatterOptions>)
Initializes a new instance of the JsonFormatter class.
public JsonFormatter(Action<JsonFormatterOptions> setup)
Parameters
setupAction<JsonFormatterOptions>The JsonFormatterOptions 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 stream of the serialized
source.
See Also
StreamFormatter<TOptions>