JSON to Avro Schema Converter
Convert JSON objects to Apache Avro schema definitions. Handles nested objects, arrays, nullable unions, and all scalar types automatically.
Related JSON Tools
What Is a JSON to Avro Schema Converter?
Apache Avro is a compact binary serialization format widely used in data pipelines, Kafka, and Hadoop ecosystems. An Avro schema (stored as .avsc) defines the structure of your data as a JSON document with typed fields. This tool reads any JSON object and generates a valid Avro record schema with correct field types, nullable unions, and nested record definitions.
How to Use
- Paste your JSON object into the left textarea.
- Set a root record name (default: Root) and namespace.
- The Avro schema is generated automatically as you type.
- Click Copy and save the output as a
.avscfile.
Features
- Generates valid Avro record schemas with correct scalar types: string, long, double, boolean.
- All fields use nullable unions (e.g.
["null", "string"]) withdefault: null. - Nested objects become inline nested record definitions.
- Arrays are converted to Avro
arraytype with inferred item type. - Configurable root record name and namespace.
- Runs entirely in your browser — no data is sent to any server.
FAQ
Why are fields wrapped in a union with null?
Avro fields are not nullable by default. To allow a field to be absent or null, the type must be a union like ["null", "string"]. This tool generates nullable unions for all fields as a safe default, since JSON values can always be null.
How are JSON numbers mapped to Avro types?
Integers map to long (64-bit) and floating-point numbers map to double. You can manually change these to int or float after generation if needed.
What is the namespace field for?
The namespace acts like a Java package name and helps avoid naming conflicts when multiple schemas are used together. It is optional — leave it blank to omit it from the generated schema.