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
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
valueJsonRpcValueAn encoded value.
shapeITypeShape<T>The result shape.
cancellationTokenCancellationTokenA cancellation token.
Returns
- T
The deserialized value.
Type Parameters
TThe 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
valueTThe value.
shapeITypeShape<T>The type shape.
cancellationTokenCancellationTokenA cancellation token.
Returns
- JsonRpcValue
An owned encoded value.
Type Parameters
TThe type of the value.
Operators
implicit operator JsonRpcSerializer(JsonSerializer)
Wraps a user-configured JSON serializer.
public static implicit operator JsonRpcSerializer(JsonSerializer serializer)
Parameters
serializerJsonSerializerThe serializer to retain.
Returns
implicit operator JsonRpcSerializer(MessagePackSerializer)
Wraps a user-configured MessagePack serializer.
public static implicit operator JsonRpcSerializer(MessagePackSerializer serializer)
Parameters
serializerMessagePackSerializerThe serializer to retain.