JSON Schema to Avro
Turn a JSON Schema into an Avro record schema from your AI assistant.
You have a JSON Schema. You need an Avro record for a schema registry or a pipeline. Use this when an API payload must also travel on a stream. The output keeps the field names, the optional field and the timestamp type. The page shows the recorded output and lists what did not carry over.
What you get
An Avro record with seven fields. discount_code is nullable and placed_at is timestamp-millis. This is the answer CoreModels gave on 3 December 2026 for the file below.
order.avsc
{
"type": "record",
"name": "Order",
"fields": [
{
"name": "order_id",
"type": "string"
},
{
"name": "customer_id",
"type": "string"
},
{
"name": "status",
"type": "string"
},
{
"name": "total_amount",
"type": "string"
},
{
"name": "currency",
"type": "string"
},
{
"name": "placed_at",
"type": {
"type": "long",
"logicalType": "timestamp-millis"
}
},
{
"name": "discount_code",
"type": [
"null",
"string"
]
}
]
}
What you need
- A CoreModels account with one project. Every plan starts with a 14-day free trial; a card is required to start.
- The tool uses the project only to check your access. It writes nothing.
- An assistant that speaks MCP, such as Claude Code, Claude Desktop or Cursor.
- A JSON Schema for one flat record: no nested objects, no lists and no
enumvalues. Today the tool refuses an inlineenum. It accepts the other shapes, but the result can be wrong.
Run it
1. Connect your assistant
In Claude Code, run this command. Then sign in when it asks.
claude mcp add --transport http coremodels https://go.coremodels.io/mcp
Cursor, Claude Desktop and other clients: connect guide.
2. Save the file as order.schema.json
Use your own file, or start with this one.
order.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.org/shop/order.schema.json",
"title": "Order",
"description": "A purchase order placed by a customer.",
"type": "object",
"additionalProperties": false,
"required": [
"order_id",
"customer_id",
"status",
"total_amount",
"currency",
"placed_at"
],
"properties": {
"order_id": {
"type": "string",
"description": "Order number printed on the receipt."
},
"customer_id": {
"type": "string",
"description": "The customer who placed the order."
},
"status": {
"type": "string",
"description": "Where the order is now."
},
"total_amount": {
"type": "string",
"description": "Order total, tax included.",
"pattern": "^-?(?:0|[1-9]\\d{0,11})(?:\\.\\d{1,2})?$"
},
"currency": {
"type": "string",
"description": "ISO 4217 currency code.",
"pattern": "^[A-Z]{3}$"
},
"placed_at": {
"type": "string",
"format": "date-time",
"description": "When the customer placed the order."
},
"discount_code": {
"type": "string",
"description": "Code used at checkout, if any."
}
}
}
3. Ask for the conversion
Use the CoreModels transform_schema tool to convert order.schema.json from jsonschema to avro. Pass the whole file as sourceSchema and again as targetHintSchema. Use any project from list_projects. Save the result as order.avsc, then list every entry in lossiness.
Your assistant calls transform_schema with these arguments. The file goes in twice: once as the source, once as the hint the mapping matches against. Without the hint the tool refuses the call.
transform_schema
{
"graphProjectId": "<your project id>",
"sourceFormat": "jsonschema",
"sourceSchema": "<contents of order.schema.json>",
"targetFormat": "avro",
"targetHintFormat": "jsonschema",
"targetHintSchema": "<contents of order.schema.json>"
}
What did not carry over
The tool returned an empty list of losses for this run. We compared the two files by hand and found these:
- Descriptions. Each field has a description in the input. The output has none.
- Text patterns. The input limits
total_amountandcurrencywith patterns. The output does not. - The namespace, package or schema id of the input file.
- The rule that forbids extra fields,
additionalProperties: false.
Compare your own files too. A different file can lose other things.
Check it yourself
Parse the file with fastavro.
pip install fastavro
python -c "import json, fastavro; fastavro.parse_schema(json.load(open('order.avsc'))); print('valid Avro')"
Same file, other formats
14-day free trial. Builder $49/mo after the trial. Cancel any time.