JSON to Avro schema: paste a JSON sample (or click Sample), set the record name and namespace, and the Avro schema (.avsc) appears instantly. If you paste an array, every item is checked, so fields missing from some items become optional ["null", type] fields with a null default. Turn on Detect uuid, date and timestamp to map those strings to Avro logical types.

Avro schema to JSON: switch to the Avro schema → JSON tab and paste your schema. The tool validates it first and lists any problems, then generates sample JSON with realistic values. Choose Plain JSON for a readable example, or Avro JSON encoding to get union values wrapped the way avro-tools fromjson and Kafka tools expect.

Everything runs in your browser. Your data is never uploaded to a server.

Frequently Asked Questions

How do I convert JSON to an Avro schema?

Paste your JSON into the tool above. It works out the Avro type for every field: string, boolean, int, long (for numbers too large for int), double, nested record types and array types. Use Copy or Download to save the result as an .avsc file.

Why does a nullable field need “null” first in the union?

In Avro, a field’s default value must match the first type in its union. To give an optional field a null default, write the type as ["null", "string"], not ["string", "null"]. The converter does this automatically, and the validator warns you if a schema gets it wrong.

What is the difference between plain JSON and Avro JSON encoding?

Plain JSON shows values as you would normally write them, for example "age": 30. Avro JSON encoding wraps every non-null union value with its type name, for example "age": {"int": 30}. Use the Avro encoding when you feed the JSON into Avro tools, such as avro-tools fromjson or a Kafka producer that reads Avro JSON.

Why was my field name changed?

Avro names may only contain letters, digits and underscores, and can’t start with a digit. A JSON key like first-name becomes first_name, and the original key is kept in the field’s doc so you can map it back.

Is my data safe?

Yes. The conversion runs entirely in your browser using JavaScript. Nothing you paste or open is sent to TheCodeBuzz or any other server. Inputs are limited to about 1 MB of text.

That’s all! Happy coding!

Does this help you fix your issue?

Do you have any better solutions or suggestions? Please sound off your comments below.