Table of Contents

Class GenericDatumJsonWriter

Namespace
AvroSharp.Generic
Assembly
AvroSharp.dll

Writes AvroValue data in the Avro JSON encoding for one schema. The schema is compiled once into a tree of typed writer nodes; instances are cached per schema and are thread-safe.

public sealed class GenericDatumJsonWriter
Inheritance
GenericDatumJsonWriter
Inherited Members

Remarks

The encoding follows the specification: a union value other than null is wrapped in an object whose only property names the branch ({"string": "a"}, {"com.example.User": {...}}); bytes and fixed are strings whose code points 0-255 each stand for one byte; enums are their symbol.

NaN and infinite float and double values, which JSON cannot express as numbers, are written as the strings "NaN", "Infinity" and "-Infinity", as Apache.Avro C# writes them.

Properties

Schema

Gets the schema values are written with.

Methods

Create(AvroSchema, GenericDatumWriterOptions?)

Gets the writer for schema, compiling it on first use. Writers with the default options are cached per schema; writers with custom options are created each time, so keep and reuse them.

Write(Utf8JsonWriter, in AvroValue)

Writes a value as one JSON value.

WriteToString(in AvroValue, bool)

Writes a value to a JSON string.

WriteToUtf8Bytes(in AvroValue, bool)

Writes a value to a UTF-8 JSON byte array.

See Also