Class JsonElementConverter
- Namespace
- ShapeShift.Json
- Assembly
- ShapeShift.Json.dll
Converts detached JsonElement values.
public sealed class JsonElementConverter : ShapeShiftConverter<JsonElement, JsonEncoder, JsonDecoder>
- Inheritance
-
JsonElementConverter
- 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
contextContractContext<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 JsonElement Read(ref JsonDecoder decoder, SerializationContext<JsonEncoder, JsonDecoder> context)
Parameters
decoderJsonDecodercontextSerializationContext<JsonEncoder, JsonDecoder>
Returns
Write(ref JsonEncoder, in JsonElement, SerializationContext<JsonEncoder, JsonDecoder>)
public override void Write(ref JsonEncoder encoder, in JsonElement value, SerializationContext<JsonEncoder, JsonDecoder> context)
Parameters
encoderJsonEncodervalueJsonElementcontextSerializationContext<JsonEncoder, JsonDecoder>