Format an Apache Avro schema

Pretty-print an Avro schema JSON document and catch an invalid top-level type.

freeworks offlinenothing uploaded
ToolAvro Schema Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The input is parsed as JSON, the top-level value must be an object, its type is checked against Avro primitive and complex names, and two-space JSON indentation is emitted. Nested field rules remain visible for full schema review.

  • Two spaces keep nested field arrays readable.
  • Validation is intentionally shallow because complete compatibility checking needs names, unions, and defaults.

Worked example

Format Avro Record Schema
Pretty-print an Avro record schema with fields
Input
											{"type":"record","name":"User","fields":[{"name":"id","type":"int"},{"name":"name","type":"string"}]}
										
Output
												{
  "type": "record",
  "name": "User",
  "fields": [
    {
      "name": "id",
      "type": "int"
    },
    {
      "name": "name",
      "type": "string"
    }
  ]
}
											

When to use this

Schema registry reviews, Spark or Hadoop data files, and compatibility checks format Avro definitions.

Edge cases

  • A JSON array or scalar is rejected instead of treated as a schema object.
  • An unknown top-level type is rejected rather than guessed as a named type.
  • A malformed nested field can pass this shallow check and still fail a full Avro compiler.

References