confluent-kafka-dotnet
Show / Hide Table of Contents

Class JsonDeserializer<T>

(async) JSON deserializer.

Inheritance
object
AsyncSerde<JsonSchema>
AsyncDeserializer<T, JsonSchema>
JsonDeserializer<T>
Implements
IAsyncDeserializer<T>
Inherited Members
AsyncDeserializer<T, JsonSchema>.schemaIdDecoder
AsyncDeserializer<T, JsonSchema>.DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)
AsyncSerde<JsonSchema>.schemaRegistryClient
AsyncSerde<JsonSchema>.ruleRegistry
AsyncSerde<JsonSchema>.useSchemaId
AsyncSerde<JsonSchema>.useLatestVersion
AsyncSerde<JsonSchema>.latestCompatibilityStrict
AsyncSerde<JsonSchema>.useLatestWithMetadata
AsyncSerde<JsonSchema>.subjectNameStrategy
AsyncSerde<JsonSchema>.serdeMutex
AsyncSerde<JsonSchema>.GetSubjectName(string, bool, string)
AsyncSerde<JsonSchema>.GetWriterSchema(string, SchemaId, string)
AsyncSerde<JsonSchema>.GetParsedSchema(Schema)
AsyncSerde<JsonSchema>.ResolveReferences(Schema)
AsyncSerde<JsonSchema>.IgnoreReference(string)
AsyncSerde<JsonSchema>.GetMigrations(string, Schema, RegisteredSchema)
AsyncSerde<JsonSchema>.GetReaderSchema(string, Schema)
AsyncSerde<JsonSchema>.ExecuteMigrations(IList<Migration>, bool, string, string, Headers, object)
AsyncSerde<JsonSchema>.ExecuteRules(bool, string, string, Headers, RuleMode, Schema, Schema, object, FieldTransformer)
AsyncSerde<JsonSchema>.ExecuteRules(bool, string, string, Headers, RulePhase, RuleMode, Schema, Schema, object, FieldTransformer)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.SchemaRegistry.Serdes
Assembly: Confluent.SchemaRegistry.Serdes.Json.dll
Syntax
public class JsonDeserializer<T> : AsyncDeserializer<T, JsonSchema>, IAsyncDeserializer<T> where T : class
Type Parameters
NameDescription
T
Remarks

Serialization format: byte 0: A magic byte that identifies this as a message with Confluent Platform framing. bytes 1-4: Unique global id of the JSON schema associated with the data (as registered in Confluent Schema Registry), big endian. following bytes: The JSON data (utf8)

Internally, uses Newtonsoft.Json for deserialization. Currently, no explicit validation of the data is done against the schema stored in Schema Registry.

Note: Off-the-shelf libraries do not yet exist to enable integration of System.Text.Json and JSON Schema, so this is not yet supported by the deserializer.

Constructors

JsonDeserializer(ISchemaRegistryClient, Schema, IEnumerable<KeyValuePair<string, string>>, JsonSchemaGeneratorSettings)

Initialize a new JsonDeserializer instance with a given Schema.

Declaration
public JsonDeserializer(ISchemaRegistryClient schemaRegistryClient, Schema schema, IEnumerable<KeyValuePair<string, string>> config = null, JsonSchemaGeneratorSettings jsonSchemaGeneratorSettings = null)
Parameters
TypeNameDescription
ISchemaRegistryClientschemaRegistryClient

Confluent Schema Registry client instance.

Schemaschema

Schema to use for validation, used when external schema references are present in the schema. Populate the References list of the schema for the same. Assuming the referenced schemas have already been registered in the registry.

IEnumerable<KeyValuePair<string, string>>config

Deserializer configuration properties (refer to JsonDeserializerConfig).

JsonSchemaGeneratorSettingsjsonSchemaGeneratorSettings

JSON schema generator settings.

JsonDeserializer(ISchemaRegistryClient, JsonDeserializerConfig, JsonSchemaGeneratorSettings, RuleRegistry)

Declaration
public JsonDeserializer(ISchemaRegistryClient schemaRegistryClient, JsonDeserializerConfig config, JsonSchemaGeneratorSettings jsonSchemaGeneratorSettings = null, RuleRegistry ruleRegistry = null)
Parameters
TypeNameDescription
ISchemaRegistryClientschemaRegistryClient
JsonDeserializerConfigconfig
JsonSchemaGeneratorSettingsjsonSchemaGeneratorSettings
RuleRegistryruleRegistry

JsonDeserializer(ISchemaRegistryClient, IEnumerable<KeyValuePair<string, string>>, JsonSchemaGeneratorSettings)

Declaration
public JsonDeserializer(ISchemaRegistryClient schemaRegistryClient, IEnumerable<KeyValuePair<string, string>> config = null, JsonSchemaGeneratorSettings jsonSchemaGeneratorSettings = null)
Parameters
TypeNameDescription
ISchemaRegistryClientschemaRegistryClient
IEnumerable<KeyValuePair<string, string>>config
JsonSchemaGeneratorSettingsjsonSchemaGeneratorSettings

JsonDeserializer(IEnumerable<KeyValuePair<string, string>>, JsonSchemaGeneratorSettings)

Initialize a new JsonDeserializer instance.

Declaration
public JsonDeserializer(IEnumerable<KeyValuePair<string, string>> config = null, JsonSchemaGeneratorSettings jsonSchemaGeneratorSettings = null)
Parameters
TypeNameDescription
IEnumerable<KeyValuePair<string, string>>config

Deserializer configuration properties (refer to JsonDeserializerConfig).

JsonSchemaGeneratorSettingsjsonSchemaGeneratorSettings

JSON schema generator settings.

Methods

DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)

Deserialize an object of type T from a byte array.

Declaration
public override Task<T> DeserializeAsync(ReadOnlyMemory<byte> data, bool isNull, SerializationContext context)
Parameters
TypeNameDescription
ReadOnlyMemory<byte>data

The raw byte data to deserialize.

boolisNull

True if this is a null value.

SerializationContextcontext

Context relevant to the deserialize operation.

Returns
TypeDescription
Task<T>

A Task that completes with the deserialized value.

Overrides
AsyncDeserializer<T, JsonSchema>.DeserializeAsync(ReadOnlyMemory<byte>, bool, SerializationContext)

ParseSchema(Schema)

Declaration
protected override Task<JsonSchema> ParseSchema(Schema schema)
Parameters
TypeNameDescription
Schemaschema
Returns
TypeDescription
Task<JsonSchema>
Overrides
AsyncSerde<JsonSchema>.ParseSchema(Schema)

Implements

IAsyncDeserializer<T>
In this article