Class GenericDatumJsonReader
Reads the Avro JSON encoding into AvroValues for one schema. Instances are cached per schema and are thread-safe.
public sealed class GenericDatumJsonReader
- Inheritance
-
GenericDatumJsonReader
- Inherited Members
Remarks
The input follows the specification (see GenericDatumJsonWriter). Record fields may appear in any
order; a missing field takes its default value, and a missing field without a default, an unknown field or a
repeated field is an error. As in Apache Avro Java, int and long also accept a whole number written
with a fraction or an exponent, such as 1.0 or 1e2, and float and double also accept
the strings "NaN", "Infinity", "-Infinity", "INF" and "-INF".
A union branch is identified by its full name, as the specification requires. For a named type, a name without the namespace is also accepted when exactly one branch has it.
Properties
- WriterSchema
Gets the schema the data was written with.
Methods
- Create(AvroSchema, GenericDatumReaderOptions?)
Gets the reader for
schema. Readers with the default options are cached per schema; readers with custom options are created each time, so keep and reuse them.
- Read(ReadOnlySpan<byte>)
Reads one value from UTF-8 JSON. Nothing but whitespace may follow it.
- Read(string)
Reads one value from a JSON string. Nothing but whitespace may follow it.
- Read(ref Utf8JsonReader)
Reads the next JSON value from
reader, for example one line of a stream of values. The reader is left on the last token of the value.
- ReadDefault(AvroSchema, JsonElement)
Converts a field's default value, as written in the schema (DefaultValue), to an AvroValue: the value a reader gives the field when the data lacks it. Defaults use the JSON encoding with one difference: a union default is not wrapped, and takes the first branch it matches.