JSON to TOON
Collapse repeated JSON objects into a header and rows
JSON Input
TOON Output
What TOON actually does to your JSON
Look at a JSON array of a thousand subscriber records and you will notice something wasteful: every single object repeats the same key names. "msisdn", "imsi", "roaming" — a thousand times each. The values change; the keys never do. TOON, short for Token-Oriented Object Notation, is a notation that spots exactly that pattern and writes the keys once.
A uniform array becomes a header carrying the row count and the field names, followed by plain delimited rows. So subscribers[3]{msisdn,imsi,roaming}: replaces three sets of braces, nine quoted key names and a scattering of commas. Anything not uniform — nested objects, ragged arrays, mixed shapes — falls back to indented key: value lines that read a lot like YAML. That mixed design is the whole point: you get the compression where it is available and readable structure everywhere else.
Because the shape is a header plus rows, TOON is unusually close to a table already, which is why it sits comfortably on this site. If you want to see that literally, paste the same document into the TOON to Table viewer and the header line becomes the column row.
The format is young and its specification and reference implementation are both public, which is worth knowing before you commit a pipeline to it. JSON itself is frozen by RFC 8259 and will not move under you; TOON is at version 0.x and still can.
Converting a document
- Paste or upload your JSON – Drop it into the left pane, or use Upload for a file from disk. Conversion runs as you type, so there is no button to hunt for.
- Watch the savings figures – The two badges above the output show how much smaller the result is. Documents built from uniform arrays do best; a deeply nested configuration file with no repetition may barely move, and that is the honest answer rather than a failure.
- Pick a delimiter if commas are awkward – Comma is the default. Switch to tab or pipe when your values contain commas — every quoted field you avoid is bytes you save. The delimiter is recorded in the header, so the document stays self-describing.
- Minify if you only care about size – Minify drops the indentation that makes nested blocks readable. Leave it off while you are reading the output and turn it on for the copy you actually ship.
- Copy or download – Download writes a
.toonfile. Nothing is uploaded anywhere — the conversion happens in this browser tab, which matters when the payload is production subscriber data.
If the savings look disappointing, check whether your array is genuinely uniform. One object with an extra field forces that array out of tabular form and back into indented blocks. Normalising the shape first — even filling the gap with null — often doubles the reduction.
A real payload, before and after
Three subscriber records. Count the times msisdn appears on each side — that difference is the entire idea.
{
"subscribers": [
{ "msisdn": "447700900142", "iccid": 8901240544102066246, "roaming": true },
{ "msisdn": "447700900377", "iccid": 8901240544102066247, "roaming": false },
{ "msisdn": "447700900518", "iccid": 8901240544102066248, "roaming": true }
],
"cell": { "cellId": 21453, "tac": 4102 }
}subscribers[3]{msisdn,iccid,roaming}: "447700900142",8901240544102066246,true "447700900377",8901240544102066247,false "447700900518",8901240544102066248,true cell: cellId: 21453 tac: 4102
When this is worth doing
Trimming a payload that is mostly repetition
Call detail records, device inventories, network KPI dumps — anything where the same handful of fields repeats across thousands of rows. These are the documents TOON was designed for, and the reduction is usually somewhere near half. A configuration file with one of everything will not shrink much, and it is better to find that out here in five seconds than after rewriting an export.
Reading a large array without scrolling forever
Pretty-printed JSON gives an array of 200 objects roughly 1,400 lines. The same array in TOON is 201 lines and every field lines up in a column, so an outlier is visible rather than buried. Plenty of people convert purely to read the thing, then throw the TOON away.
Sending structured data where every character counts
Any channel that bills or limits by token or character rewards a denser encoding. Halving a payload halves that cost with no change to what the data means, which is a rare kind of win.
Comparing two exports
Row-per-record output diffs far more cleanly than nested JSON, where a single added field reindents an entire block. Convert both sides, then run them through JSON Diff or an ordinary text diff.
What this converter does carefully
- Long identifiers survive. An ICCID like
8901240544102066246comes out with every digit intact. Most converters run your numbers through JavaScript'sJSON.parsefirst, which silently rounds anything pastNumber.MAX_SAFE_INTEGER— and two SIMs one digit apart can collapse onto the same value. - A quoted number stays a string.
"8901240544102066246"is not the same as8901240544102066246, and the distinction survives the conversion in both directions. - Three delimiters. Comma, tab and pipe, each recorded in the header so the output can be read back without you remembering which you chose.
- Nothing leaves your browser. No upload, no server round trip, no stored copy.
- Exact size, honest tokens. The byte figure is measured. The token figure is an estimate and is labelled as one, because counting tokens properly needs a tokenizer this page will not make you download.
Questions people actually ask
How much smaller is TOON, really?
For a uniform array of flat records, expect somewhere around half. For nested configuration with little repetition, expect very little. The badges on this page tell you the truth for your document, which is more useful than any headline number — including the one at the top of this page.
Is TOON just CSV with extra steps?
For a single flat array they look similar, and that is not an accident. The difference is that CSV cannot express nesting at all, while TOON drops back to indented blocks when the data stops being tabular. A document with a header object and an array of rows is one TOON file and two CSV files plus an explanation. If your data really is flat, JSON to CSV is the simpler choice.
Can I convert back?
Yes — TOON to JSON is the reverse, and a document that made the trip out will make the trip home unchanged, long integers included. That round trip is tested rather than assumed.
Why did my array not collapse into rows?
Tabular form needs every object in the array to carry the same fields. One record with an extra key, or a nested object inside a record, and the array is written as indented blocks instead. Inconsistent shapes are the usual culprit — the same thing that makes such arrays awkward to load into a table.
Should I store my data as TOON?
Probably not yet. It is at 0.x, tooling outside JavaScript is thin, and JSON is understood by everything you already run. TOON earns its place as a transport or viewing format — something you convert to at the edge, not the format of record. If you want a middle ground for large arrays, JSON Lines is older, duller and very widely supported.
Does the delimiter change the meaning?
No, only the bytes. It is written into the header — rows[3|]{a|b}: for pipe — so any compliant reader picks it up. Choose the one your values do not contain and you will avoid quoting entirely.
Related tools
Worth reading
- The TOON specification – Grammar, the tabular-array rules, and the reference implementation this page uses
- RFC 8259 — the JSON standard – Including the section on numeric interoperability that explains the rounding problem