Avro Schema Validator
Check a JSON record against an Avro AVSC schema and see exactly which fields fail and why.
- Free
- No sign-up
- Runs in your browser
Schema Validator: loading the in-browser tool…
No warranty. Unless required by applicable law, this tool is provided on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. You are solely responsible for determining the appropriateness of using it and assume any risks associated with doing so.
How it works
Validation runs against the real Avro library, in your browser, the same checks your pipeline would apply.
Paste your AVSC schema
Drop an Avro schema definition into the left editor. We parse it with the real Avro library, so it is checked exactly as a producer or consumer would.
Add a JSON record
Paste the message you want to check on the right. In Auto mode it re-checks as you type; switch to Manual to validate only when you click.
Read the field-level result
Every mismatch is listed with its path, the expected type, and the value we actually found, so you know precisely what to fix.
Your data stays put. Your schema and record are parsed and validated entirely in your browser. Nothing is uploaded, logged, or sent to any server.
Avro schemas and Avro JSON
What is an Avro schema and where is it used?
Apache Avro is a data serialization system. It defines a compact binary format, a JSON encoding of the same data, and rules for reading data written with an older or newer version of its schema. Avro binary carries no field names, so data is always written and read against a schema.
The schema is the data contract. It names the fields a record has, gives each a type, and says which may be absent. A producer and a consumer that share it can change independently, within the schema resolution rules of the Avro specification.
In Kafka, Avro schemas usually live in a Schema Registry. A producer registers its schema and tags each message with the schema id, and the registry refuses a new version that would break existing consumers. Avro is also a common file format in data lakes and in Hadoop and Spark jobs, where the schema travels in the file header. The validator checks a schema and a record against each other before either reaches a topic or a file.
What the validator checks
An Avro schema, or AVSC file, is JSON that describes a record. A record has a name and a list of fields, and each field has a name and a type. A type is a primitive such as string, long, double or boolean, a nested record, an array with its items type, or a union written as a list of types.
An optional field is a union with null first and "default": null. The default must match the first branch of the union, so ["null","string"] takes a null default and ["string","null"] does not.
The record you check must follow Avro's JSON encoding, which is stricter than plain JSON. A null union value is written bare. Any other union value is wrapped in an object keyed by its branch: {"string": "SAVE10"}. A logical type is written as its base type, so a timestamp-millis field holds a long of epoch milliseconds, not an ISO date. An int or long must be a whole number. A record branch is keyed by its full name, namespace included, such as {"shop.Address": {...}} when the schema sets the namespace shop.
A failing record gets Invalid: and the error count, then one line per field in the form path: expected <type>, got <value>. The path walks into arrays by index, so items.0.qty is the qty of the first item.
Worked example: an unwrapped union
This is the Load example schema and record with one change: coupon holds the bare string "SAVE10" instead of null.
{
"type": "record",
"name": "Order",
"fields": [
{
"name": "orderId",
"type": "string"
},
{
"name": "total",
"type": "double"
},
{
"name": "vip",
"type": "boolean"
},
{
"name": "coupon",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "items",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "Item",
"fields": [
{
"name": "sku",
"type": "string"
},
{
"name": "qty",
"type": "long"
}
]
}
}
}
]
}{
"orderId": "A-10473",
"total": 248.5,
"vip": true,
"coupon": "SAVE10",
"items": [
{
"sku": "KAF-1",
"qty": 2
}
]
}Invalid: 1 field error.
coupon: expected ["null","string"], got "SAVE10"Every other field passes. coupon is a union of null and string, and a string value has to name its branch. Write "coupon": {"string": "SAVE10"} and the result reads Record is valid against the schema.
Common errors
items.0.qty: expected "long", got "2"qtyis along, and the record quotes it, so the value is a string.Drop the quotes:
"qty": 2. A fraction such as2.5fails the same way, because alongtakes whole numbers only.total: expected "double", got undefinedThe record leaves out
total, which has no default.undefinedin the message means the field is absent from the record.Add the field, or give it a default in the schema. A field with a default, such as
coupon, can be left out.createdAt: expected "long", got "2026-10-24T09:30:00Z"The schema adds
createdAtas alongwith the logical typetimestamp-millis, and the record gives it an ISO date. The message names the base type, because that is what the JSON must hold.Write epoch milliseconds:
"createdAt": 1792834200000is 09:30 UTC on 24 October 2026.undefined type name: strngThe schema spells
orderIdas typestrng. The result is titledSchema error, and no record is checked until the schema parses.Fix the spelling. A type name is either a primitive or the name of a record or enum the schema defines earlier.
invalid "string": nullcouponis declared as["string","null"]with"default": null. The default is checked against the first branch, which here isstring. This is also aSchema error.Put
nullfirst:["null","string"].
FAQ
Why does my nullable field fail Avro validation?
Because a nullable field is a union, and in Avro JSON a union value other than null must name its type. "coupon": "SAVE10" fails and "coupon": {"string": "SAVE10"} passes. null itself is written bare, as "coupon": null.
The reason is the binary format. Avro writes a union as the index of its branch followed by the value, so the JSON encoding has to say which branch the value takes. A record produced by an ordinary JSON serializer leaves that out, which is why it fails here even though it looks right.
How do I write a timestamp in Avro JSON?
As a number. A timestamp-millis is a long of milliseconds since the Unix epoch, a timestamp-micros a long of microseconds, and a date an int of days. An ISO string fails with expected "long", or expected "int" for a date.
Does the validator report fields that are not in the schema?
No. Fields the schema does not declare are ignored, which hides a misspelt optional field. "cupon": {"string": "SAVE10"} passes, because coupon has a default and may be absent.
Can I leave out a field that has a default?
Yes. A record without coupon passes, because the schema gives it "default": null. A field with no default must be present, even if its type is a union with null.
How do I check an Avro schema on its own?
Leave the record empty. A schema that parses gets Schema parses OK. Add a JSON record to validate. One that does not gets Schema error and the parser's message.
Is my schema or data uploaded anywhere?
No. The validator runs in your browser, and nothing you paste is sent to a server.
Need this check running in production?
TypedFlows runs the same Avro schema validation inside your production deployments.