JSON to Avro Schema Converter

Generate a draft Avro schema (.avsc) from sample JSON. Runs locally in your browser.

JSON

Avro Schema

{
"type": "record",
"name": "Root",
"fields": [
{
"name": "orderId",
"type": "string"
},
{
"name": "customer",
"type": {
"type": "record",
"name": "Customer",
"fields": [
{
"name": "name",
"type": "string"
},
{
"name": "email",
"type": "string"
}
]
}
},
{
"name": "items",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "Item",
"fields": [
{
"name": "sku",
"type": "string"
},
{
"name": "quantity",
"type": "int"
},
{
"name": "unitPriceCents",
"type": "int"
}
]
}
}
},
{
"name": "status",
"type": "string"
}
]
}
​

The Kafka IDE

Register and evolve Avro schemas in Kafma

Kafma is a desktop app for Kafka. Register schemas, compare version changes, and publish updates with Schema Registry compatibility checks.

macOS Windows Linux
Kafma drafting a new Avro version of orders.created-value with a live diff and compatibility set to BACKWARD
Kafka Schema Explorer

JSON to Avro FAQ

Why does the schema contain unions or nullable fields?
Mixed array values such as [1, "a"] produce a union of int and string. A field present in only some array objects becomes nullable with a null default. Compatible numeric types are combined into a wider type.
Why did "1999" stay string in the Avro schema?
Quoted digit strings stay string. Unquoted integers that fit signed 32-bit become int; larger safe integers become long. If a quoted value should be numeric, copy the schema into your editor or Kafma and adjust its type.
Why is a JSON key missing from the Avro schema?
Fields containing only null or empty arrays are omitted because their types cannot be inferred. Provide a concrete sample value and convert again.
Why is the root record named Root?
The converter uses Root as a placeholder name. Copy the schema into your editor or Kafma, then rename it before registering.
How do I use this schema with Kafka?
Review the inferred field types and names, then register the schema in Kafka Schema Explorer. Use the registered schema to generate and serialize a payload in Kafka Console and produce it to a topic.
Is my input uploaded?
No. Conversion runs in your browser. Your input and generated output are not uploaded.
Can I generate sample JSON from an Avro schema?
Use the Avro to JSON converter to generate sample JSON from an Avro schema.