Avro to TOON
Turn an Avro schema or JSON-encoded record into TOON that decodes back to the same data
Input
Output
Paste your Avro on the left and the TOON shows up here.
Or drop a file on this box, , or .
What does Avro to TOON do?
A JSON-encoded Apache Avro schema repeats the same shape over and over: a fields array where every entry is {"name": ..., "type": ...}. TOON was designed for exactly that. Paste the schema or a record on the left and the right pane shows it encoded as TOON: objects become indented key: value lines, every array carries its length as [N], and an array of flat objects with the same keys collapses into a table with one header such as fields[4]{name,type}: and one comma-separated row per entry.
The output follows the TOON specification, so it is something a parser can read, not just a picture of the data. Strings are quoted whenever leaving them bare would change their meaning: "42" and "true" keep their quotes so they stay strings, as do values containing a comma or a colon, like "Unique order identifier, e.g. ORD-58231". Since the Avro 1.11 specification writes schemas and encoded data alike as JSON, the page accepts either and encodes whatever tree it is given.
A long past 2^53 (an 18-digit order ID, say) keeps every digit it had, which a plain JSON.parse round trip would not manage. The conversion happens in your browser tab.
How to Use Avro to TOON
The TOON on the right is rebuilt 300 ms after your last keystroke, so pasting is enough.
Paste, Upload, or Load a Sample
Drop a record or a schema into Input, open an .avsc or .json with Upload, or click Sample for the Order schema with its OrderItem list and optional Address. A trip record like this one is a good first test, because it mixes a nested object, a list and a few scalars:
{"tripId":"TRIP-77310","driver":{"name":"Ingrid Solberg","rating":4.9},"stops":["Gardermoen","Majorstuen"],"fareNok":612.5,"surge":false} The trip record above comes out as:
tripId: TRIP-77310
driver:
name: Ingrid Solberg
rating: 4.9
stops[2]: Gardermoen,Majorstuen
fareNok: 612.5
surge: false Records with nested objects, lists of scalars and unions are all handled. If the input is a JSON string that itself holds JSON, which happens when a schema is copied out of a log line, it is unwrapped once before encoding.
Read the TOON Output
In the Output panel, nested objects are indented two spaces, a list of plain values such as symbols[4]: USD,EUR,GBP,JPY fits on one line, and a list of objects is written either as a table (when every entry has the same scalar fields) or as - items. In the Sample, the Address record's fields become fields[4]{name,type}: followed by four rows, while the top-level fields[7]: stays a list because some entries carry a doc or a nested type.
Copy or Download
Take the result with Copy, or keep a file with Download (it is named output.toon). To check it, paste it into the TOON to JSON page and you get the original JSON back. The trash-can icon clears the input.
When You'd Actually Use This
Schema Reviews That Read Like Prose
Reading an Avro schema PR with twelve nested records is tiring, because the braces and quotes pile up. In TOON each field is a line or a table row, which is easier to follow when you are skimming a change in a Schema Registry review or a chat thread.
Pasting into Markdown
A wiki page or README that explains a pipeline can show the TOON form of the schema inside a code fence. It has no braces to balance and far fewer quotes than JSON, and readers who already know YAML pick up the indentation rules straight away.
Diffing Avro Records
Two JSON-encoded Avro records and you want to know what changed. Because TOON puts each scalar on its own line, or each table row on its own line, a line-based diff points at the field that moved instead of a reshuffled run of brackets.
Onboarding Material
Sending a schema or a batch of records to a language model as context costs fewer tokens as TOON than as JSON, mostly because the table form writes each key once instead of once per row. That saving is the reason the format exists.
Common Questions
What is TOON, and is there a spec?
Token-Oriented Object Notation (TOON) is a text encoding of the JSON data model with a published specification and reference implementations. It keeps JSON's types (objects, arrays, strings, numbers, booleans, null) and spends fewer characters on them: indentation instead of braces, array lengths in the header, and a table layout for uniform arrays of objects.
How does it compare to YAML?
Both use indentation, but TOON is much smaller. There are no anchors, aliases, tags or multi-document streams, and every array states its length, so a truncated file is caught instead of silently read short. If you need a configuration format with parsers in every language, YAML is the safer choice; TOON is aimed at passing structured data around compactly.
Does the output decode back to my original JSON?
Yes. We test the converter by decoding its output with a TOON decoder and comparing the result with the input: the Sample, the trip record above and records with quoted numbers, colons, commas and an 18-digit integer all come back identical. Key order is kept as well.
How are strings with colons, commas or dashes handled?
They are quoted. A string is left bare only when a decoder would read it back as the same string, so ship to: Gate 4, a,b, - urgent, an empty string and anything that looks like a number, boolean or null come out in double quotes. Plain words like record or Ingrid Solberg stay bare.
Why do some arrays become tables and others lists?
The table form needs every element to be an object with the same keys and only scalar values. The Address fields in the Sample qualify, so they get a {name,type} header. The outer fields array does not, because some entries have a doc and some a nested type object, so each entry is written as a - item instead.
Can the input be a JSON-encoded Avro record and not a schema?
Yes. Both are JSON, and the converter encodes whichever tree it receives. The JSON encoding section of the Avro spec shows what the record form looks like, including how a union value is wrapped in an object named after its branch.
Other Avro and Conversion Tools
For a format other than TOON, the same Avro JSON goes into any of these: