Avro to JSON
Generate a sample JSON record from an Avro schema — instant, in the browser
Input
Output
What does Avro to JSON do?
You have an Apache Avro schema (.avsc) and you want to see an example record that fits it — for a unit test fixture, a mock API response, or just to understand what the producer is going to send. Paste the schema into the left panel and the right panel returns a JSON record where every field has a sensible placeholder value: "example" for strings, 1 for ints and longs, true for booleans, the first symbol for enums, an array of one element for arrays, and so on.
The generator walks the schema as defined in the Avro 1.11 specification: records produce objects with each field, arrays produce a one-element array, maps produce {key: ...}, enums pick the first symbol, fixed types produce a string of zeros at the right length, and unions pick the first non-null branch. Named types defined earlier in the schema are reused when referenced later — the same record class shows up consistently. The output is well-formed RFC 8259 JSON, so you can drop it straight into JSON.parse() or any HTTP client.
This is sample data for development, not realistic test data. The orderId will be <code>"example"</code>, not <code>"ORD-58231"</code>. If you need realistic fixtures with names, dates, and prices that look real, hand-edit the output or feed it through a faker library — the tool gives you the shape, you bring the realism.
How to Use Avro to JSON
Three quick steps. The buttons described below are the actual buttons on this page.
Paste, Upload, or Load a Sample
Paste an Avro schema into the left Input panel. Click Upload for an .avsc file, or hit Sample to load the realistic Order schema with nested OrderItem records, an enum currency, and a nullable Address. Quick example of what minified Avro looks like:
{"type":"record","name":"Order","namespace":"com.example.commerce","fields":[{"name":"orderId","type":"string"},{"name":"totalCents","type":"long"}]}The schema must be valid JSON in .avsc form. If you have a binary .avro Object Container File, use avro-tools getschema first to extract the schema, then paste the JSON here.
Read the Generated JSON
The right Output panel shows a fully-formed JSON record matching the schema. Every required field is present, nullable fields default to the non-null branch (a real value, not null), arrays contain one example element, enums pick the first symbol. If the schema parses but is structurally weird, you will see fields with placeholder values where the inferrer could not figure out the type.
Copy, Download, or Tweak
Hit Copy to paste the JSON into a test fixture, a Postman request, or a Kafka Schema Registry producer's payload. Hit Download to save as sample.json. Edit the placeholder values to be realistic, or pipe the structure through your faker of choice. Parsing is done with the browser's native JSON.parse() — your schema never leaves the page.
When You'd Actually Use This
Test Fixtures for Consumers
You are writing a Kafka consumer that reads Order events. The producer is not built yet, but the schema is. Paste the schema here, get a sample record, drop it in fixtures/order.json and write the consumer test against it.
Mock API Responses
You are spinning up a mock REST API to unblock the frontend team while the real backend is in flight. The data contract is an Avro schema. Generate the JSON shape, hand it to the mock server, frontend can start integrating today.
Schema Smoke Test
Reviewing an Avro schema PR. You want a quick "if I produced this schema, what would the message look like?" gut check. Paste the schema, eyeball the JSON, ship the review.
Documentation Examples
Writing a wiki page about an event your team produces. Drop the schema in here, copy the sample JSON into the doc as the "Example payload" section. Less effort than typing it out by hand.
Common Questions
What value does it pick for a union like ["null", "string"]?
The first non-null branch. So ["null", "string"] produces "example", not null. The thinking is that you almost always want to see real values when generating samples — null is rarely useful in a fixture. If you need null specifically, edit the output.
Does it handle named type references and recursive schemas?
Yes for forward-defined named types — once a record is seen, it is cached and reused if referenced later by name. Truly recursive schemas (a tree where node references node) will recurse one level and then resolve the reference; you will not get infinite output, but you will get a single nested layer.
Why does my decimal logical type come back as 1.0 instead of a number string?
The generator looks at the underlying physical type — bytes or fixed — and produces a placeholder for that. Logical type semantics like decimal(10, 2) are not reified into a real decimal value, see the logical types section of the spec for the actual encoding rules.
Will it validate that my schema is structurally correct first?
It validates JSON syntax only. Structural Avro rules (every record needs type, name, fields; primitive type names are exact) are not checked here — for that, use the Avro Validator. If the schema is broken, the generator will still try, and the output may have placeholder strings where the type was unrecognizable.
Is the schema sent to a server?
No. Generation runs entirely in your browser. JSON.parse() and a small recursive walker do all the work. Nothing is uploaded, nothing is logged.
What's the difference between this and an Avro deserializer?
A deserializer takes binary Avro-encoded bytes plus a schema and produces JSON. This tool takes only the schema and produces a placeholder JSON record — no real data is involved. If you have actual Avro binary data, run it through avro-tools tojson first, then paste the JSON output into the Avro Viewer.
Other Avro and JSON Tools
Generating samples is one step. These tools handle the rest of the Avro lifecycle: