JsonModelConverter Class

Definition

A generic converter which allows JsonSerializer to be able to write and read any models that implement IJsonModel<T>.

public class JsonModelConverter : System.Text.Json.Serialization.JsonConverter<System.ClientModel.Primitives.IJsonModel<object>>
type JsonModelConverter = class
    inherit JsonConverter<IJsonModel<obj>>
Public Class JsonModelConverter
Inherits JsonConverter(Of IJsonModel(Of Object))
Inheritance
JsonModelConverter

Remarks

Since IJsonModel<T> defines what the serialized shape should look like the JsonSerializerOptions are ignored except for those pertaining to indentation formatting.

Constructors

JsonModelConverter()

Initializes a new instance of JsonModelConverter with a default options of Json.

JsonModelConverter(ModelReaderWriterOptions)

Initializes a new instance of JsonModelConverter.

Methods

CanConvert(Type)

Determines whether the type can be converted.

Read(Utf8JsonReader, Type, JsonSerializerOptions)

Read and convert the JSON to T.

Write(Utf8JsonWriter, IJsonModel<Object>, JsonSerializerOptions)

Write the value as JSON.

Applies to