Table of Contents

Class JsonRpcSerializer

Namespace
Nerdbank.JsonRpc
Assembly
Nerdbank.JsonRpc.dll

Encodes and decodes JSON-RPC application values using one selected serializer.

public abstract class JsonRpcSerializer
Inheritance
JsonRpcSerializer
Derived
Inherited Members

Properties

Encoding

Gets the wire encoding.

public abstract JsonRpcEncoding Encoding { get; }

Property Value

JsonRpcEncoding

Methods

Deserialize<T>(JsonRpcValue, ITypeShape<T>, CancellationToken)

Deserializes a typed value with its type shape.

public T Deserialize<T>(JsonRpcValue value, ITypeShape<T> shape, CancellationToken cancellationToken = default)

Parameters

value JsonRpcValue

An encoded value.

shape ITypeShape<T>

The result shape.

cancellationToken CancellationToken

A cancellation token.

Returns

T

The deserialized value.

Type Parameters

T

The result type.

Serialize<T>(in T, ITypeShape<T>, CancellationToken)

Serializes a typed value with its type shape.

public JsonRpcValue Serialize<T>(in T value, ITypeShape<T> shape, CancellationToken cancellationToken = default)

Parameters

value T

The value.

shape ITypeShape<T>

The type shape.

cancellationToken CancellationToken

A cancellation token.

Returns

JsonRpcValue

An owned encoded value.

Type Parameters

T

The type of the value.

Operators

implicit operator JsonRpcSerializer(JsonSerializer)

Wraps a user-configured JSON serializer.

public static implicit operator JsonRpcSerializer(JsonSerializer serializer)

Parameters

serializer JsonSerializer

The serializer to retain.

Returns

JsonRpcSerializer

implicit operator JsonRpcSerializer(MessagePackSerializer)

Wraps a user-configured MessagePack serializer.

public static implicit operator JsonRpcSerializer(MessagePackSerializer serializer)

Parameters

serializer MessagePackSerializer

The serializer to retain.

Returns

JsonRpcSerializer