Show / Hide Table of Contents

Class JsonSerializer

Serializes and deserializes objects and types to and from JSON structures.

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: Manatee.Json.Serialization
Assembly: Manatee.Json.dll
Syntax
public class JsonSerializer

Properties

| Improve this Doc View Source

AbstractionMap

Gets or sets the abstraction map used by this serializer.

Declaration
public AbstractionMap AbstractionMap { get; set; }
Property Value
Type Description
AbstractionMap
| Improve this Doc View Source

Options

Gets or sets a set of options for this serializer.

Declaration
public JsonSerializerOptions Options { get; set; }
Property Value
Type Description
JsonSerializerOptions

Methods

| Improve this Doc View Source

Deserialize(Type, JsonValue)

Deserializes a JSON structure to an object of the appropriate type.

Declaration
public object? Deserialize(Type type, JsonValue json)
Parameters
Type Name Description
System.Type type

The type of the object that the JSON structure represents.

JsonValue json

The JSON representation of the object.

Returns
Type Description
System.Nullable<System.Object>

The deserialized object.

Exceptions
Type Condition
TypeDoesNotContainPropertyException

Optionally thrown during automatic deserialization when the JSON contains a property which is not defined by the requested type.

| Improve this Doc View Source

Deserialize<T>(JsonValue)

Deserializes a JSON structure to an object of the appropriate type.

Declaration
public T Deserialize<T>(JsonValue json)
Parameters
Type Name Description
JsonValue json

The JSON representation of the object.

Returns
Type Description
T

The deserialized object.

Type Parameters
Name Description
T

The type of the object that the JSON structure represents.

Exceptions
Type Condition
TypeDoesNotContainPropertyException

Optionally thrown during automatic deserialization when the JSON contains a property which is not defined by the requested type.

| Improve this Doc View Source

DeserializeType<T>(JsonValue)

Deserializes a JSON structure to the public static properties of a type.

Declaration
public void DeserializeType<T>(JsonValue json)
Parameters
Type Name Description
JsonValue json

The JSON representation of the type.

Type Parameters
Name Description
T

The type to deserialize.

Exceptions
Type Condition
TypeDoesNotContainPropertyException

Optionally thrown during automatic deserialization when the JSON contains a property which is not defined by the requested type.

| Improve this Doc View Source

GenerateTemplate<T>()

Generates a template JSON inserting default values.

Declaration
public JsonValue GenerateTemplate<T>()
Returns
Type Description
JsonValue
Type Parameters
Name Description
T
| Improve this Doc View Source

Serialize(Type, Object)

Serializes an object to a JSON structure.

Declaration
public JsonValue Serialize(Type type, object obj)
Parameters
Type Name Description
System.Type type

The type of the object to serialize.

System.Object obj

The object to serialize.

Returns
Type Description
JsonValue

The JSON representation of the object.

| Improve this Doc View Source

Serialize<T>(T)

Serializes an object to a JSON structure.

Declaration
public JsonValue Serialize<T>(T obj)
Parameters
Type Name Description
T obj

The object to serialize.

Returns
Type Description
JsonValue

The JSON representation of the object.

Type Parameters
Name Description
T

The type of the object to serialize.

| Improve this Doc View Source

SerializeType<T>()

Serializes the public static properties of a type to a JSON structure.

Declaration
public JsonValue SerializeType<T>()
Returns
Type Description
JsonValue

The JSON representation of the type.

Type Parameters
Name Description
T

The type to serialize.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX