June 12, 2026 · 2 min read · Yunus Emre Vurgun

TOON Format Grammar: A Practical Overview

toon · grammar · spec · parsing
In this guide
  1. Objects and indentation
  2. Four array forms
  3. Strings and quoting
  4. Numbers, booleans, null
  5. Empty values
  6. Reading it back

TOON (Token-Oriented Object Notation) is a line-based text format for JSON-shaped data. It trades braces and repeated keys for indentation and tables. This overview covers the parts you meet in practice; the normative rules live in the specification, and the YJTOON encoder is checked against the reference implementation on every build.

Objects and indentation

An object is a list of key: value lines. Nesting is two spaces of indentation; there are no braces and no trailing commas. A key with nothing after the colon introduces a nested object.

dataset:
  slug: tcp-ip-protocol-suite
  title: TCP/IP Protocol Suite

Four array forms

The array length is written in the header, in square brackets. The encoder picks the form from the data's shape:

FormWhenExample
InlineArray of primitivestags[3]: a,b,c
TabularArray of objects with the same keys and primitive valuesrows[2]{id,name}: then 1,Ada and 2,Linus
Keyed tabularObject whose values are uniform objectsenv[2:]{region,replicas}:
ListAnything else: mixed types, non-uniform objectsitems[2]: then - a: 1 lines

The tabular form is where the savings come from: field names are written once in the header instead of once per record. A real example from this site:

data[4]{layer,protocols}:
  Application,"HTTP, HTTPS, FTP, SMTP, DNS, SSH"
  Transport,"TCP, UDP"
  Internet,"IP, ICMP, ARP, IGMP"
  Network Access,"Ethernet, Wi-Fi, PPP"

Strings and quoting

Strings are unquoted unless that would be ambiguous. Spaces inside a string are fine (Network Access above). A string is quoted when it is empty, has leading or trailing spaces, equals true, false or null, looks like a number, contains a comma, colon, quote, backslash, bracket or brace, starts with a hyphen or #, or contains a control character. Quoted strings use the escapes \\, \", \n, \r and \t.

Numbers, booleans, null

Numbers are written in canonical decimal form: no exponent for ordinary values, no trailing zeros (1.50 becomes 1.5), and -0 becomes 0. NaN and infinities become null. Booleans and null are the bare words.

Empty values

An empty array is key: []. An empty object is a bare key: line. Documents have no trailing newline.

Reading it back

Because every array declares its length, a parser never has to guess where a block ends, which is why a working reader fits in under a hundred lines — see a small TOON parser in Python. To see the encoder work on your own data, paste JSON into TOON Studio.

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets