TOON to JSON
Expand a header-and-rows document back into ordinary objects
TOON Input
JSON Output
Getting your data back out of TOON
Someone hands you a .toon file, or a block of text that opens with something like subscribers[3]{msisdn,iccid,roaming}:, and the tool you need to feed it speaks JSON. That is what this page is for. Paste the document on the left and the objects come back on the right, indented and ready to use.
The expansion is mechanical. A header line names the fields and states how many rows follow; each row is split on the document's delimiter and zipped back against those field names. Indented key: value blocks become nested objects. Unquoted scalars are read as numbers, booleans or null where they look like one and as strings otherwise — the same rules the reference implementation applies.
One thing worth knowing before you trust any TOON reader: the row count in that header is checked. If it says three rows and four follow, the document is rejected rather than quietly truncated. That strictness is a feature — a silently dropped record is far more expensive than an error message.
Reading a TOON document
- Paste the TOON – Left pane, or Upload for a file. Conversion is immediate and re-runs as you edit, so you can fix a malformed row and watch it resolve.
- Check the header if it complains – Most failures come from the header rather than the data: a row count that no longer matches after someone hand-edited a line, or a field list that does not match the row width. The error names the line.
- Mind the indentation – Nested blocks use spaces, and a stray tab will not be treated as indentation. If a block that should be nested comes back flat, that is usually why.
- Copy or download the JSON – Output is indented with two spaces. Download writes a
.jsonfile. Everything happens in this tab — the document is never sent anywhere.
If you are round-tripping — JSON out to TOON and back again — the result should be byte-identical to what you started with, long integers included. If it is not, the interesting question is which direction changed the value, and pasting both into JSON Diff answers it in seconds.
Rows back into objects
The header on the left carries the field names once. On the right they are repeated per record, which is exactly the trade TOON makes.
subscribers[3]{msisdn,iccid,roaming}: "447700900142",8901240544102066246,true "447700900377",8901240544102066247,false "447700900518",8901240544102066248,true cell: cellId: 21453 tac: 4102
{
"subscribers": [
{
"msisdn": "447700900142",
"iccid": 8901240544102066246,
"roaming": true
},
{
"msisdn": "447700900377",
"iccid": 8901240544102066247,
"roaming": false
}
],
"cell": { "cellId": 21453, "tac": 4102 }
}When you need this
Feeding TOON to something that only reads JSON
Most of the ecosystem — databases, HTTP clients, spreadsheet importers, your own code — has no idea what TOON is. Converting at the boundary is usually a one-line change to a pipeline rather than a rewrite.
Checking that a conversion did not lose anything
Convert to TOON, convert back, compare against the original. If the two match, the trip is safe for that document. This is worth doing once with real production data before trusting any format conversion in a pipeline — including ours.
Reading a file someone sent you
A tabular block is dense and easy to misread when the columns are wide. Expanded JSON puts a field name beside every value, which is slower to scan but much harder to misattribute. For a middle ground, TOON to Table keeps the density and adds column headers.
Extracting one section of a larger document
Once it is JSON, everything else on this site applies — export it as CSV, walk it as a tree, or reformat it.
What this converter gets right
- Long identifiers keep every digit. A 19-digit ICCID in a TOON row comes out of here as the same 19 digits. The underlying library reads scalars with
parseFloat, so8901240544102066246and8901240544102066247both become8901240544102066000— two different SIMs landing on one value. This page reads those tokens before that happens and emits a bare, exact JSON integer. - Strings that look like numbers stay strings. A quoted
"447700900142"keeps its quotes; an unquoted one becomes a number. That distinction matters for phone numbers and zero-padded codes, and RFC 8259 §6 is worth reading on why the safe move is to keep such identifiers as strings. - All three delimiters are read automatically. Comma, tab or pipe — the header declares which, so you do not have to tell the page anything.
- Row counts are enforced. A header promising three rows followed by four is an error, not a silent truncation.
- Nothing is uploaded. The conversion runs in this browser tab.
Questions people actually ask
Why is my JSON so much bigger than the TOON?
Because the field names are back, once per record. That is the whole difference between the two formats, and a 2–3× increase on a tabular document is normal rather than a sign something went wrong.
Will the round trip give me exactly what I started with?
For the data, yes — including integers past JavaScript's safe integer limit. Formatting is a different matter: key order within a record is preserved, but your original indentation and any blank lines are not, because those were never encoded into the TOON in the first place.
It says my row count is wrong, but the rows look fine.
Count them again including the header line, then check for a trailing blank line inside the block. The other common cause is a value containing an unquoted delimiter, which splits one row into two fields too many — switching the source document to a pipe or tab delimiter usually makes the problem obvious.
Can I edit the TOON here and convert as I go?
Yes. The left pane is editable and the output updates as you type, which makes this a reasonable way to fix a broken document. If the JSON side is what needs tidying afterwards, the JSON Formatter handles that.
Is TOON related to JSON Lines?
They solve overlapping problems differently. JSON Lines puts one complete JSON object per line, so keys still repeat but the file streams well. TOON removes the repetition instead. JSON Lines is far more widely supported; TOON is denser.
Related tools
Worth reading
- The TOON specification – The grammar, the strict row-count rules, and the reference decoder
- MDN — JSON.parse() – Including the reviver argument, and why numbers are the one thing it cannot hand back faithfully