Table of Contents

Class JsonDocumentConverter

Namespace
ShapeShift.Json
Assembly
ShapeShift.Json.dll

Converts JsonDocument values.

public sealed class JsonDocumentConverter : ShapeShiftConverter<JsonDocument, JsonEncoder, JsonDecoder>
Inheritance
JsonDocumentConverter
Inherited Members

Methods

GetContract(ContractContext<JsonEncoder, JsonDecoder>)

Describes the serialized form that this converter produces and accepts.

public override DataContract? GetContract(ContractContext<JsonEncoder, JsonDecoder> context)

Parameters

context ContractContext<JsonEncoder, JsonDecoder>

Services for describing other types that this converter composes with.

Returns

DataContract

The contract for the data this converter reads and writes, or null if this converter does not describe itself.

Remarks

The default implementation returns null, which causes ShapeShift to describe the type with an UndocumentedContract rather than guess at a representation. Override this method so that schema consumers can understand your converter's output.

The returned contract must describe exactly what WriteObject(ref TEncoder, object?, SerializationContext<TEncoder, TDecoder>) emits.

Read(ref JsonDecoder, SerializationContext<JsonEncoder, JsonDecoder>)

public override JsonDocument? Read(ref JsonDecoder decoder, SerializationContext<JsonEncoder, JsonDecoder> context)

Parameters

decoder JsonDecoder
context SerializationContext<JsonEncoder, JsonDecoder>

Returns

JsonDocument

Write(ref JsonEncoder, in JsonDocument?, SerializationContext<JsonEncoder, JsonDecoder>)

public override void Write(ref JsonEncoder encoder, in JsonDocument? value, SerializationContext<JsonEncoder, JsonDecoder> context)

Parameters

encoder JsonEncoder
value JsonDocument
context SerializationContext<JsonEncoder, JsonDecoder>