About the Avro Formatter
An Avro schema file is JSON, so any JSON beautifier will indent it, but only a formatter that knows Avro puts the keys back in a readable order. This page prints type, name, namespace and doc at the top of every schema object, keeps name ahead of type inside each entry of a fields array, and pushes anything it does not recognise to the bottom in alphabetical order.
Short unions stay on one line. A branch list such as ["null", "string"] reads better inline than split across three rows, so arrays whose members are all scalars collapse whenever they fit inside the inline width you choose. Enum symbol lists behave the same way. Everything else is expanded one key per line at your chosen indent.
With the schema check switched on, the tool walks the whole document before printing. A record without a fields array, a field with no name, an enum symbol containing a space, a union with no branches or a fixed type with no size are all reported with the path where they sit, for example schema.fields[3].type. Logical types such as timestamp-millis and decimal pass through untouched. Turn the check off if you are formatting a schema fragment that is not valid on its own. For plain JSON documents use the JSON Formatter, and to see the shape of a large schema as a tree open the JSON Viewer.
How to use
- Paste the contents of your .avsc file into the left pane.
- Pick an indent width and leave Canonical key order on to match the layout most Avro repositories use.
- Read the status line for the record, enum and field counts the schema contains.
- Copy the result back into your repository, or download it as
schema.avsc.
Common questions
- Does this validate an Avro schema completely?
- It checks structure: required keys, union branches, enum symbol spelling and fixed sizes. It does not resolve named type references across separate files, which only a full Avro parser can do.
- Why did my field keys get reordered?
- Canonical order puts name before type inside a field so the schema reads like a column list. Switch key order to "As written" if you need the original sequence preserved.
- Can it handle Avro IDL files?
- No. The .avdl syntax is a different language. Compile it to .avsc with the Avro tools jar first, then paste the JSON here.
- Are logical types supported?
- Yes. Keys such as logicalType, precision and scale are kept and printed in the canonical position under their parent type object.