What does this Avro to JSON converter do?
This tool generates sample JSON from an Avro schema. Use the output as a starting point for test payloads. The structure follows the schema you paste; the values are generated samples that you can replace with your own data.
The JSON is type-correct for that schema. It is not business-correct: IDs, timestamps, and enum symbols are placeholders, not records from your system. The tool does not decode binary Avro messages or Avro IDL. Parsing and generation run in your browser; the schema and JSON are not sent to a server.
Why the JSON looks different from your Avro schema
These differences come from the Avro JSON encoding, not from a failed conversion. Union wrappers and numeric timestamps are required by that mapping.
| What you see | Why, and whether to change it |
|---|---|
A union became {"string": "note-1"} | Non-null union values are wrapped in the branch type name. null stays JSON null. Keep the wrapper if you send Avro JSON to a console producer. |
A long is an unquoted number | Avro JSON encodes int and long as JSON numbers, not strings. Large values can lose precision in JavaScript; quote them only if you change the schema to string. |
timestamp-millis is a large number | Logical timestamps stay epoch milliseconds on a long. They are not RFC 3339 strings. |
A bytes field looks like plain text | Avro JSON stores bytes as a string of raw characters, not Base64. |
An enum as "PAID" | Enums are emitted as symbol names. Replace the symbol if your test needs another value. |
Separate from those mapping rules, this page fills each array with one element and each map with one key entry so you can see the shape. Add more items if your test needs them.
Missing fields or conversion errors
If the JSON is missing fields you expected, or the editor shows an error, use the row that matches what you see.
| What you see | Cause | What to do |
|---|---|---|
| Avro schema must be JSON, not Avro IDL | The input is IDL such as record Order { … } | Paste the JSON Avro schema (a .avsc file), not .avdl |
| Unknown type: Customer | A named type is not in the current input. This page does not fetch other files or Schema Registry subjects. | Paste the missing named type into this editor so the schema is self-contained. |
| Cannot generate a finite sample | Nested records stop at depth 4. Recursive unions with a null branch become null; required recursion cannot produce a valid sample | Add a ["null", …] branch, or fill nested values by hand |
| Invalid JSON near a token | The schema text is not valid JSON | Fix the syntax, then wait for the JSON to regenerate |
Use the sample in a Kafka producer
This JSON is an editing input in Avro JSON encoding. Producing an Avro message still requires the matching schema and a serializer. Sending the JSON as plain text does not turn it into an Avro payload.
In Kafma Schema Explorer open the Registry subject and version, then generate or adjust the payload in the Kafka Console and produce it. Confirm union wrappers and logical types against the version you produce.