Avro Formatter
Format, validate, and canonicalize Apache Avro schemas.
Avro Formatter – Format and Validate Avro Schemas
Apache Avro schemas are JSON documents that describe records for Kafka topics, Hadoop files, and RPC messages. The Avro formatter pretty-prints .avsc files and, unlike a plain JSON formatter, checks the schema against the Avro specification so you catch problems before a schema registry rejects them.
Three modes
- Beautify – indented JSON with 2 or 4 spaces or tabs.
- Minify – compact single-line JSON, ready to embed in code or send to a registry API.
- Canonical form – the Avro Parsing Canonical Form: names fully qualified, attributes such as
doc,default, andaliasesremoved, keys ordered, and whitespace stripped. Two schemas that are equivalent for reading data produce the same canonical form, which is what fingerprints (like the CRC-64-AVRO used in single-object encoding) are calculated from.
Schema validation
Below the editors you see whether the schema is valid. The validator checks:
- Every type is a primitive (
null,boolean,int,long,float,double,bytes,string), a complex type, or a named type defined earlier. - Records have a valid
nameand afieldsarray with unique field names and types. - Enums have unique, valid symbols, and their
defaultis one of them. - Arrays have
items, maps havevalues, and fixed types have asize. - Unions do not contain duplicate types or nested unions.
- Logical types annotate the right type:
decimalonbytes/fixedwith a precision,timestamp-millisonlong,dateonint,uuidonstring. - Named types are not defined twice.
Errors are listed with a JSON path such as $.fields[2].type.symbols[1] so you can find them quickly.
Related tools
Validate plain JSON with the JSON Validator, explore large schemas in the JSON Viewer, or compare two schema versions with JSON Diff.
Frequently Asked Questions
What is the Parsing Canonical Form?
It is a normalized version of a schema defined by the Avro specification. Attributes that don't affect reading data, like doc and default, are removed, names are fully qualified, and whitespace is stripped. Equivalent schemas have the same canonical form and fingerprint.
Does it check compatibility between schema versions?
No. It validates a single schema. Backward and forward compatibility checks require comparing two schemas, which schema registries do when you register a new version.
Can it read Avro data files?
No. This tool works with schemas (.avsc JSON). Binary .avro data files contain a schema header plus encoded records and need an Avro library to decode.
Why is my schema valid JSON but invalid Avro?
Typical causes are a reference to a type that is not defined yet, a duplicate field name, an enum default that is not a symbol, or a logical type on the wrong base type. The error list shows the exact path.