{"id":827977,"date":"2025-11-17T13:06:24","date_gmt":"2025-11-17T13:06:24","guid":{"rendered":"https:\/\/made.digitalwebmarketing.agency\/toon-data-format-ai-models\/"},"modified":"2026-11-19T21:43:14","modified_gmt":"2026-11-19T21:43:14","slug":"toon-data-format-ai-models","status":"publish","type":"post","link":"https:\/\/www.yourdigitalweb.com\/en\/toon-data-format-ai-models\/","title":{"rendered":"TOON: A Data Format Optimized for AI Models"},"content":{"rendered":"<p data-start=\"299\" data-end=\"659\">If you use large language models (LLMs) like GPT-4, Claude or Google Gemini to process structured data, you\u2019re most likely using JSON as your input and output format today. JSON is the de facto standard for data exchange between systems thanks to its simplicity, huge adoption and native support practically everywhere.<\/p>\n<p data-start=\"661\" data-end=\"1128\">In the context of AI prompts, however, JSON can become surprisingly inefficient: every curly brace <code data-start=\"774\" data-end=\"778\">{}<\/code>, every square bracket <code data-start=\"792\" data-end=\"796\">[]<\/code>, every quotation mark <code data-start=\"814\" data-end=\"817\">\"<\/code> and every repeated key counts as a token when sent to an LLM. In a large prompt, these \u201cinvisible\u201d syntax characters can inflate the token count (and therefore costs) without adding any real information. That\u2019s where the idea of a leaner format for talking to models comes from.<\/p>\n<p data-start=\"661\" data-end=\"1128\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-9081\" src=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example.jpg\" alt=\"\" width=\"1024\" height=\"1024\" title=\"\" srcset=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example.jpg 1024w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example-300x300.jpg 300w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example-150x150.jpg 150w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example-768x768.jpg 768w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example-600x600.jpg 600w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-example-649x649.jpg 649w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p data-start=\"1130\" data-end=\"1513\">This need led to the creation of <strong data-start=\"1174\" data-end=\"1215\">TOON (Token-Oriented Object Notation)<\/strong>, a new open-source data format designed specifically for AI models. Introduced in October 2025, TOON quickly gained popularity thanks to its promise of cutting the tokens needed in prompts by 30\u201360% compared with the equivalent JSON, while keeping the same information structure.<!--more--><\/p>\n<h2 data-start=\"1520\" data-end=\"1551\">What TOON is and why it was created<\/h2>\n<p data-start=\"1553\" data-end=\"1758\">TOON is a data serialization format that is <strong data-start=\"1599\" data-end=\"1623\">compact and readable<\/strong> (for both humans and models) and represents the same structures as JSON but with a syntax optimized to minimize tokens.<\/p>\n<p data-start=\"1760\" data-end=\"2114\">In other words, TOON preserves exactly the same information as an equivalent JSON (it\u2019s <strong data-start=\"1852\" data-end=\"1864\">lossless<\/strong>, convertible back and forth without loss), but removes superfluous punctuation and syntactic redundancy that weigh down LLM prompts. A simple way to describe it is: <strong data-start=\"2039\" data-end=\"2111\">\u201clike JSON, but rewritten in the grammar AI models prefer\u201d<\/strong>.<\/p>\n<p data-start=\"2116\" data-end=\"2424\">Formats like JSON, XML or YAML weren\u2019t created to interact with language models, but to let software systems communicate. As a result they include many <strong data-start=\"2271\" data-end=\"2307\">redundant syntactic structures<\/strong> (brackets, commas, quotes, repeated keys) that are useful to traditional parsers but not really needed by an LLM.<\/p>\n<p data-start=\"2426\" data-end=\"2759\">An AI model \u201csees\u201d text as a sequence of tokens and gets no particular benefit from formatting characters: if a JSON has 100 objects, each with 10 fields, the names of those fields will be repeated 100 times. As prompts grow, this inefficiency becomes a significant <strong data-start=\"2724\" data-end=\"2742\">hidden cost<\/strong> .<\/p>\n<p data-start=\"2761\" data-end=\"2840\"><strong data-start=\"2761\" data-end=\"2813\">TOON was created to solve exactly this problem<\/strong>, with a few key ideas:<\/p>\n<ul data-start=\"2842\" data-end=\"3891\">\n<li data-start=\"2842\" data-end=\"3011\">\n<p data-start=\"2844\" data-end=\"3011\"><strong data-start=\"2844\" data-end=\"2874\">No brackets and commas<\/strong>: TOON completely removes <code data-start=\"2903\" data-end=\"2907\">{}<\/code>, <code data-start=\"2909\" data-end=\"2913\">[]<\/code> and many separating commas, replacing them with indentation and a tabular syntax.<\/p>\n<\/li>\n<li data-start=\"3012\" data-end=\"3143\">\n<p data-start=\"3014\" data-end=\"3143\"><strong data-start=\"3014\" data-end=\"3050\">No double quotes for keys<\/strong>: field names aren\u2019t wrapped in quotes, further reducing verbosity.<\/p>\n<\/li>\n<li data-start=\"3144\" data-end=\"3268\">\n<p data-start=\"3146\" data-end=\"3268\"><strong data-start=\"3146\" data-end=\"3173\">Hierarchical indentation<\/strong>: as in YAML, indentation defines the nested structure instead of curly braces.<\/p>\n<\/li>\n<li data-start=\"3269\" data-end=\"3498\">\n<p data-start=\"3271\" data-end=\"3498\"><strong data-start=\"3271\" data-end=\"3301\">Lists in tabular format<\/strong>: arrays of objects take a \u201ctable\u201d form: you declare the list of fields (the header) once and then list the values row by row. This removes needless repetition.<\/p>\n<\/li>\n<li data-start=\"3499\" data-end=\"3674\">\n<p data-start=\"3501\" data-end=\"3674\"><strong data-start=\"3501\" data-end=\"3534\">Explicit length markers<\/strong>: every array declares up front how many elements it contains (e.g. <code data-start=\"3598\" data-end=\"3604\">[10]<\/code>), so the model doesn\u2019t have to infer or count the number of elements.<\/p>\n<\/li>\n<li data-start=\"3675\" data-end=\"3891\">\n<p data-start=\"3677\" data-end=\"3891\"><strong data-start=\"3677\" data-end=\"3706\">Two-way conversion<\/strong>: any valid JSON can be converted to TOON and back without information loss, acting as a \u201ctranslator\u201d for data sent to models (and for reading the answers).<\/p>\n<\/li>\n<\/ul>\n<h2>Practical example: JSON vs TOON<\/h2>\n<p data-start=\"4151\" data-end=\"4229\">To see the difference in practice, let\u2019s look at a simple data example.<\/p>\n<p data-start=\"4231\" data-end=\"4308\"><strong data-start=\"4231\" data-end=\"4248\">Classic JSON<\/strong><br data-start=\"4248\" data-end=\"4251\">Suppose we have an object with a list of users:<\/p>\n<p><code>{ \"users\": [ { \"id\": 1, \"name\": \"Alice\", \"role\": \"admin\" }, { \"id\": 2, \"name\": \"Bob\", \"role\": \"user\" } ] }<br \/>\n<\/code><strong data-start=\"4450\" data-end=\"4470\">Equivalent TOON<\/strong><br data-start=\"4470\" data-end=\"4473\">The same data is written in TOON like this:<\/p>\n<p><code>users[2]{id,name,role}: 1,Alice,admin 2,Bob,user<br \/>\n<\/code><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-9062\" src=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-vs-toon.png\" alt=\"\" width=\"704\" height=\"289\" title=\"\" srcset=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-vs-toon.png 704w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-vs-toon-300x123.png 300w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-vs-toon-600x246.png 600w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><\/p>\n<p>The <code data-start=\"4602\" data-end=\"4610\">users<\/code> object immediately declares that it contains <code data-start=\"4640\" data-end=\"4645\">[2]<\/code> elements and defines, in the header <code data-start=\"4682\" data-end=\"4699\">{id,name,role}<\/code>, the fields valid for all of them. The following rows contain only the values, in the specified order.<\/p>\n<p data-start=\"4807\" data-end=\"5072\">There are no curly braces or square brackets, nor quotes around the keys. The informational meaning is identical, but the TOON version uses far fewer symbols and, in this specific case, requires <strong data-start=\"5010\" data-end=\"5039\">less than half the tokens<\/strong> of traditional JSON.<\/p>\n<h2 data-start=\"5079\" data-end=\"5123\">TOON vs. JSON:<\/h2>\n<div class=\"_tableContainer_1rjym_1\">\n<div class=\"group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"5125\" data-end=\"7036\">\n<thead data-start=\"5125\" data-end=\"5364\">\n<tr data-start=\"5125\" data-end=\"5364\">\n<th data-start=\"5125\" data-end=\"5159\" data-col-size=\"sm\">Characteristic<\/th>\n<th data-start=\"5159\" data-end=\"5259\" data-col-size=\"md\">JSON (JavaScript Object Notation)<\/th>\n<th data-start=\"5259\" data-end=\"5364\" data-col-size=\"md\">TOON (Token-Oriented Object Notation)<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"5605\" data-end=\"7036\">\n<tr data-start=\"5605\" data-end=\"5843\">\n<td data-start=\"5605\" data-end=\"5638\" data-col-size=\"sm\"><strong data-start=\"5607\" data-end=\"5619\">Syntax<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"5638\" data-end=\"5738\">Requires <code data-start=\"5649\" data-end=\"5653\">{}<\/code>, <code data-start=\"5655\" data-end=\"5659\">[]<\/code>, <code data-start=\"5661\" data-end=\"5664\">,<\/code> and <code data-start=\"5667\" data-end=\"5670\">\"<\/code> for keys and strings.<\/td>\n<td data-col-size=\"md\" data-start=\"5738\" data-end=\"5843\">Removes <code data-start=\"5748\" data-end=\"5752\">{}<\/code>, <code data-start=\"5754\" data-end=\"5758\">[]<\/code> and many <code data-start=\"5767\" data-end=\"5770\">,<\/code> unnecessary ones. Uses indentation; keys don\u2019t need quotes.<\/td>\n<\/tr>\n<tr data-start=\"5844\" data-end=\"6084\">\n<td data-start=\"5844\" data-end=\"5881\" data-col-size=\"sm\"><strong data-start=\"5846\" data-end=\"5880\">Token efficiency<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"5881\" data-end=\"5979\">Very verbose, especially with arrays of objects (repeated keys). High token consumption.<\/td>\n<td data-col-size=\"md\" data-start=\"5979\" data-end=\"6084\">Optimized to minimize tokens. Typical savings of 30\u201360% compared with the equivalent JSON.<\/td>\n<\/tr>\n<tr data-start=\"6085\" data-end=\"6322\">\n<td data-start=\"6085\" data-end=\"6118\" data-col-size=\"sm\"><strong data-start=\"6087\" data-end=\"6111\">List handling<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"6118\" data-end=\"6217\">Every object in the array repeats structure and keys.<\/td>\n<td data-col-size=\"md\" data-start=\"6217\" data-end=\"6322\">\u201cTabular\u201d format: keys (header) are declared only once at the start of the list.<\/td>\n<\/tr>\n<tr data-start=\"6323\" data-end=\"6560\">\n<td data-start=\"6323\" data-end=\"6356\" data-col-size=\"sm\"><strong data-start=\"6325\" data-end=\"6343\">Guidance for the AI<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"6356\" data-end=\"6455\">The AI has to interpret the entire syntax to infer the structure.<\/td>\n<td data-col-size=\"md\" data-start=\"6455\" data-end=\"6560\">Provides \u201cguardrails\u201d: explicit length <code data-start=\"6489\" data-end=\"6494\">[N]<\/code> and schema <code data-start=\"6504\" data-end=\"6513\">{fields}<\/code> , reducing parsing errors.<\/td>\n<\/tr>\n<tr data-start=\"6561\" data-end=\"6798\">\n<td data-start=\"6561\" data-end=\"6594\" data-col-size=\"sm\"><strong data-start=\"6563\" data-end=\"6584\">Human readability<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"6594\" data-end=\"6693\">A universal standard, but it can become hard to read when deeply nested or repetitive.<\/td>\n<td data-col-size=\"md\" data-start=\"6693\" data-end=\"6798\">Highly readable, similar to YAML. The tabular structure for lists is immediately clear.<\/td>\n<\/tr>\n<tr data-start=\"6799\" data-end=\"7036\">\n<td data-start=\"6799\" data-end=\"6832\" data-col-size=\"sm\"><strong data-start=\"6801\" data-end=\"6826\">Main use case<\/strong><\/td>\n<td data-col-size=\"md\" data-start=\"6832\" data-end=\"6931\">De facto standard for APIs, configuration files and data exchange between systems.<\/td>\n<td data-col-size=\"md\" data-start=\"6931\" data-end=\"7036\">Specialized for LLM prompts: sending and receiving structured data to\/from AI models.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2 data-start=\"7043\" data-end=\"7082\">Advantages and features of TOON<\/h2>\n<p data-start=\"7084\" data-end=\"7193\">By implementing the ideas above, TOON offers a series of <strong data-start=\"7137\" data-end=\"7158\">concrete advantages<\/strong> for anyone working with AI models:<\/p>\n<ul data-start=\"7195\" data-end=\"9177\">\n<li data-start=\"7195\" data-end=\"7665\">\n<p data-start=\"7197\" data-end=\"7665\"><strong data-start=\"7197\" data-end=\"7230\">Fewer tokens<\/strong><br data-start=\"7230\" data-end=\"7233\">This is the most obvious benefit. In practice, TOON typically lets you use 30% to 60% fewer tokens than the equivalent JSON. In benchmarks on large, uniform datasets, the savings are consistent: for example, for 10,000 user records, TOON may require about 4,500 tokens of syntax versus ~10,000 for classically structured JSON. Fewer tokens means <strong data-start=\"7622\" data-end=\"7636\">lower costs<\/strong> and <strong data-start=\"7639\" data-end=\"7662\">faster responses<\/strong>.<\/p>\n<\/li>\n<li data-start=\"7667\" data-end=\"8103\">\n<p data-start=\"7669\" data-end=\"8103\"><strong data-start=\"7669\" data-end=\"7699\">Readability for humans and AI<\/strong><br data-start=\"7699\" data-end=\"7702\">TOON keeps a clear structure. The indented syntax and tabular form make it easy to scan visually. For the model, the input is easier to interpret because it has no syntactic \u201cnoise\u201d; every token present carries more information. Several tests have found that TOON can even slightly improve how accurately the AI extracts or summarizes information compared with the equivalent JSON.<\/p>\n<\/li>\n<li data-start=\"8105\" data-end=\"8581\">\n<p data-start=\"8107\" data-end=\"8581\"><strong data-start=\"8107\" data-end=\"8133\">Fewer parsing errors<\/strong><br data-start=\"8133\" data-end=\"8136\">By explicitly declaring the schema and the length of lists, TOON gives the LLM strict, predictable guides. The model knows which fields to include and how many elements to expect, which reduces the likelihood of malformed output (missing fields, broken syntax, incomplete rows). This is especially useful when you ask the AI to return structured data that your code must then process automatically.<\/p>\n<\/li>\n<li data-start=\"8583\" data-end=\"9177\">\n<p data-start=\"8585\" data-end=\"9177\"><strong data-start=\"8585\" data-end=\"8625\">Compatibility and simple conversion<\/strong><br data-start=\"8625\" data-end=\"8628\">Adopting TOON <strong data-start=\"8644\" data-end=\"8678\">doesn\u2019t mean abandoning JSON<\/strong>. You can keep using JSON throughout your application (APIs, databases, configuration files) and simply convert it to TOON when sending it to the model, then decode any response back to JSON.<br data-start=\"8913\" data-end=\"8916\">TOON supports the same basic data types as JSON (strings, numbers, booleans, null) and the same nested structures. Where possible it compresses into tabular format; where it can\u2019t, the structure still resembles YAML, keeping clarity and compatibility.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"9179\" data-end=\"9460\">In short, TOON <strong data-start=\"9196\" data-end=\"9240\">doesn\u2019t replace JSON everywhere<\/strong>: JSON remains irreplaceable for complex configurations, APIs and data exchange between systems. TOON should be seen as a <strong data-start=\"9353\" data-end=\"9380\">specialized tool<\/strong>, to use when your counterpart is an AI model and cost per token matters.<\/p>\n<h2 data-start=\"9467\" data-end=\"9514\">When to use TOON<\/h2>\n<p data-start=\"9516\" data-end=\"9650\">TOON works best in scenarios with <strong data-start=\"9555\" data-end=\"9621\">uniform, tabular, not too deeply nested structured data<\/strong>. Some typical use cases:<\/p>\n<ul data-start=\"9652\" data-end=\"10662\">\n<li data-start=\"9652\" data-end=\"9967\">\n<p data-start=\"9654\" data-end=\"9967\"><strong data-start=\"9654\" data-end=\"9685\">Uniform \u201cspreadsheet-like\u201d lists<\/strong><br data-start=\"9685\" data-end=\"9688\">If your data looks like a table with similar rows (user list, product catalog, event log, order list, inventory, etc.), TOON is particularly effective. You avoid repeating the same field names for every element by declaring the header only once.<\/p>\n<\/li>\n<li data-start=\"9969\" data-end=\"10334\">\n<p data-start=\"9971\" data-end=\"10334\"><strong data-start=\"9971\" data-end=\"10003\">Prompts with lists or tables<\/strong><br data-start=\"10003\" data-end=\"10006\">If you need to pass an LLM a list of items with a fixed structure for analysis, filtering, clustering or summaries, TOON lets you include many more items in the context for the same number of tokens. For example, you can have the model read a product catalog, a review dataset or an event log in compact form.<\/p>\n<\/li>\n<li data-start=\"10336\" data-end=\"10662\">\n<p data-start=\"10338\" data-end=\"10662\"><strong data-start=\"10338\" data-end=\"10379\">Large uniform datasets<\/strong><br data-start=\"10379\" data-end=\"10382\">For training, testing or evaluating LLMs with many structured examples (tabular prompts, Q&amp;A on data, etc.), TOON lets you inject more examples per context window. The larger and more regular the dataset, the more significant the benefits.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"10664\" data-end=\"10770\">In short, <strong data-start=\"10674\" data-end=\"10728\">if your data looks like a spreadsheet<\/strong>, TOON is probably the right choice.<\/p>\n<h2 data-start=\"10777\" data-end=\"10833\">When to avoid TOON<\/h2>\n<p data-start=\"10835\" data-end=\"10925\">TOON isn\u2019t always the best solution. There are cases where it\u2019s better to stick with JSON:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul data-start=\"10927\" data-end=\"12062\">\n<li data-start=\"10927\" data-end=\"11198\">\n<p data-start=\"10929\" data-end=\"11198\"><strong data-start=\"10929\" data-end=\"10960\">Deeply nested data<\/strong><br data-start=\"10960\" data-end=\"10963\">If the structure has many hierarchical levels (a \u201cChristmas tree\u201d with many sub-objects and sub-lists), TOON can become less clear and even consume more tokens than JSON, because it can\u2019t make good use of the tabular mode.<\/p>\n<\/li>\n<li data-start=\"11200\" data-end=\"11478\">\n<p data-start=\"11202\" data-end=\"11478\"><strong data-start=\"11202\" data-end=\"11247\">Non-uniform or highly heterogeneous structures<\/strong><br data-start=\"11247\" data-end=\"11250\">If each array element has different fields or a variable schema, TOON\u2019s strength (avoiding uniform repetition) disappears. In these cases the token savings are minimal or zero, and JSON remains more straightforward.<\/p>\n<\/li>\n<li data-start=\"11480\" data-end=\"11800\">\n<p data-start=\"11482\" data-end=\"11800\"><strong data-start=\"11482\" data-end=\"11524\">Contexts with strict format requirements<\/strong><br data-start=\"11524\" data-end=\"11527\">If you\u2019re interacting with systems that expect JSON (public APIs, microservices, databases, third-party libraries), there\u2019s no point introducing TOON. Use it <strong data-start=\"11690\" data-end=\"11736\">only in the communication step with the LLM<\/strong>; not as a storage format or public interface.<\/p>\n<\/li>\n<li data-start=\"11802\" data-end=\"12062\">\n<p data-start=\"11804\" data-end=\"12062\"><strong data-start=\"11804\" data-end=\"11848\">Premature optimization on small data<\/strong><br data-start=\"11848\" data-end=\"11851\">If the data volume is small and token cost isn\u2019t a practical issue, introducing TOON may be unnecessary effort. JSON already works well on small volumes and is supported everywhere.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 data-start=\"12069\" data-end=\"12101\">How to start using TOON<\/h2>\n<p data-start=\"12103\" data-end=\"12265\">TOON was designed to be easy to adopt on top of existing ecosystems. There are already official (and unofficial) libraries and tools that make it easier to use.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-9064\" src=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-ai.png\" alt=\"\" width=\"1024\" height=\"1024\" title=\"\" srcset=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-ai.png 1024w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-ai-300x300.png 300w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/toon-ai-150x150.png 150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h3 data-start=\"12267\" data-end=\"12312\">Official library (Node.js\/TypeScript)<\/h3>\n<p data-start=\"12314\" data-end=\"12516\">TOON\u2019s developers have released an official NPM package for JavaScript\/TypeScript. The library exposes methods such as <code data-start=\"12441\" data-end=\"12451\">encode()<\/code> and <code data-start=\"12454\" data-end=\"12464\">decode()<\/code> to convert both ways between JSON and TOON.<\/p>\n<p data-start=\"12518\" data-end=\"12548\">Example in a Node project:<\/p>\n<p><code>import { encode, decode } from \"@toon-format\/toon\";<\/code><code>const data = {<\/code><br \/>\n<code>users: [<\/code><br \/>\n<code>{ id: 1, name: \"Alice\", role: \"admin\" },<\/code><br \/>\n<code>{ id: 2, name: \"Bob\", role: \"user\" }<\/code><br \/>\n<code>]<\/code><br \/>\n<code>};<\/code><code>const toonText = encode(data);<\/code><\/p>\n<p><code>\/*<\/code><br \/>\n<code>toonText now contains:<\/code><\/p>\n<p><code>users[2]{id,name,role}:<\/code><br \/>\n<code>1,Alice,admin<\/code><br \/>\n<code>2,Bob,user<\/code><br \/>\n<code>*\/<\/code><\/p>\n<p><code>const jsonData = decode(toonText); \/\/ Back to the original JSON object<\/code><\/p>\n<p data-start=\"12939\" data-end=\"13088\">In practice, you can keep JSON inside your application and turn it into TOON only at the point where you build the prompt to send to the model.<\/p>\n<h3 data-start=\"13090\" data-end=\"13118\">Command-line CLI<\/h3>\n<p data-start=\"13120\" data-end=\"13312\">There\u2019s also a command-line tool to convert JSON files to TOON and back. It\u2019s useful for quickly testing TOON\u2019s effectiveness on your real data and measuring token savings.<\/p>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\">\n<p data-start=\"13397\" data-end=\"13520\">The command converts <code data-start=\"13417\" data-end=\"13428\">data.json<\/code> to TOON and shows statistics such as the number of characters and the estimated tokens saved.<\/p>\n<h3 data-start=\"13522\" data-end=\"13550\">Other languages and tools<\/h3>\n<p data-start=\"13552\" data-end=\"13801\">The community has started developing libraries and bindings for various languages: <strong data-start=\"13629\" data-end=\"13639\">Python<\/strong>, <strong data-start=\"13641\" data-end=\"13649\">Rust<\/strong>, <strong data-start=\"13651\" data-end=\"13657\">Go<\/strong>, <strong data-start=\"13659\" data-end=\"13666\">PHP<\/strong>, <strong data-start=\"13668\" data-end=\"13678\">Kotlin<\/strong>, <strong data-start=\"13680\" data-end=\"13689\">Swift<\/strong>, and integrations with AI frameworks such as prompt orchestrators, agent frameworks and automation tools.<\/p>\n<p data-start=\"13552\" data-end=\"13801\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9072\" src=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2.jpg\" alt=\"\" width=\"1024\" height=\"1024\" title=\"\" srcset=\"https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2.jpg 1024w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2-300x300.jpg 300w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2-150x150.jpg 150w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2-768x768.jpg 768w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2-600x600.jpg 600w, https:\/\/www.yourdigitalweb.com\/wp-content\/uploads\/2025\/11\/jason-toon-2-649x649.jpg 649w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h2 data-start=\"13808\" data-end=\"13845\">Practical tips and best practices<\/h2>\n<ul data-start=\"13847\" data-end=\"15146\">\n<li data-start=\"13847\" data-end=\"14102\">\n<p data-start=\"13849\" data-end=\"14102\"><strong data-start=\"13849\" data-end=\"13874\">Use it only where needed<\/strong><br data-start=\"13874\" data-end=\"13877\">Keep JSON for APIs, storage, logs and integrations between systems. Convert it to TOON <strong data-start=\"13962\" data-end=\"14006\">only in the step between backend and AI model<\/strong>. This hybrid approach gives you efficiency in prompts and maximum compatibility everywhere else.<\/p>\n<\/li>\n<li data-start=\"14104\" data-end=\"14520\">\n<p data-start=\"14106\" data-end=\"14520\"><strong data-start=\"14106\" data-end=\"14141\">Choose the best delimiter<\/strong><br data-start=\"14141\" data-end=\"14144\">By default TOON uses a comma <code data-start=\"14177\" data-end=\"14180\">,<\/code> to separate values in tabular rows. If your values contain many commas (for example text descriptions), or you want to further reduce ambiguity, you can use <strong data-start=\"14356\" data-end=\"14371\">tabs<\/strong> (<code data-start=\"14373\" data-end=\"14377\">\\t<\/code>), or the <strong data-start=\"14394\" data-end=\"14402\">pipe<\/strong> (<code data-start=\"14404\" data-end=\"14407\">|<\/code>character) as the separator. In many tokenizers, the tab behaves favorably in terms of tokens consumed.<\/p>\n<\/li>\n<li data-start=\"14522\" data-end=\"14819\">\n<p data-start=\"14524\" data-end=\"14819\"><strong data-start=\"14524\" data-end=\"14562\">Always validate the model\u2019s output<\/strong><br data-start=\"14562\" data-end=\"14565\">If you ask the model to return data in TOON, check that it\u2019s syntactically valid using the decoding function in \u201cstrict\u201d mode. This way you can catch errors such as inconsistent <code data-start=\"14765\" data-end=\"14770\">[N]<\/code> counts, missing rows or extra columns.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"14823\" data-end=\"15146\"><strong data-start=\"14823\" data-end=\"14861\">Don\u2019t force it where it loses efficiency<\/strong><br data-start=\"14861\" data-end=\"14864\">If tests show that for a particular structure the token savings are zero or negative, don\u2019t use TOON at all costs. You can adopt it only for the parts of the prompt suited to the tabular format (for example large lists) and leave the rest in JSON or natural text.<\/p>\n<p data-start=\"13314\" data-end=\"13343\">Typical usage example:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\"><code>cat data.json | npx toon-cli --stats<\/code><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 data-start=\"15153\" data-end=\"15179\">Ecosystem and adoption<\/h2>\n<p data-start=\"15181\" data-end=\"15466\">TOON is a <strong data-start=\"15200\" data-end=\"15245\">recent but fast-growing open-source project<\/strong>. The initial specification was published at the end of 2025 and the official GitHub repository quickly gathered tens of thousands of stars, a sign of strong interest from the AI developer community.<\/p>\n<p data-start=\"15468\" data-end=\"15518\">The community immediately started creating:<\/p>\n<ul data-start=\"15520\" data-end=\"15717\">\n<li data-start=\"15520\" data-end=\"15562\">\n<p data-start=\"15522\" data-end=\"15562\">implementations for various languages,<\/p>\n<\/li>\n<li data-start=\"15563\" data-end=\"15591\">\n<p data-start=\"15565\" data-end=\"15591\">command-line tools,<\/p>\n<\/li>\n<li data-start=\"15592\" data-end=\"15651\">\n<p data-start=\"15594\" data-end=\"15651\">integrations with prompt orchestration frameworks,<\/p>\n<\/li>\n<li data-start=\"15652\" data-end=\"15717\">\n<p data-start=\"15654\" data-end=\"15717\">plugins for development environments and no-code\/low-code tools.<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"15719\" data-end=\"16023\">It\u2019s important to remember, however, that <strong data-start=\"15753\" data-end=\"15778\">TOON is still young<\/strong>: there are no formal standards yet or native support in the most widely used cloud services (which keep speaking JSON or XML). For now, TOON use is driven mainly by practical LLM use cases and community initiative.<\/p>\n<h2 data-start=\"16259\" data-end=\"16295\">References<\/h2>\n<ol data-start=\"16297\" data-end=\"17048\" data-is-last-node=\"\" data-is-only-node=\"\">\n<li data-start=\"16297\" data-end=\"16433\">Official TOON documentation \u2013 \u201cToken-Oriented Object Notation (TOON) \u2013 Specification and README of the open-source project\u201d, GitHub repository toon-format\/toon.<\/li>\n<li data-start=\"16297\" data-end=\"16433\"><\/li>\n<li data-start=\"16594\" data-end=\"16706\">\n<p data-start=\"16597\" data-end=\"16706\">Abhilaksh Arora \u2013 \u201cTOON: The Smarter, Lighter JSON for LLMs\u201d, technical article published on DEV Community.<\/p>\n<\/li>\n<li data-start=\"16707\" data-end=\"16889\">\n<p data-start=\"16710\" data-end=\"16889\">FreeCodeCamp News \u2013 \u201cWhat is TOON? How Token-Oriented Object Notation Could Change How AI Sees Data\u201d, an introductory guide to TOON and its use cases with language models.<\/p>\n<\/li>\n<li data-start=\"16890\" data-end=\"17048\" data-is-last-node=\"\">\n<p data-start=\"16893\" data-end=\"17048\" data-is-last-node=\"\">JSONToTable Blog \u2013 \u201cTOON Format Specification: Complete TOON JSON Syntax Guide\u201d, a complete guide to the syntax and conversion rules between JSON and TOON.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you use large language models (LLMs) like GPT-4, Claude or Google Gemini to process structured data, you\u2019re most likely using JSON as your input and output format today. JSON is the de facto standard for data exchange between systems thanks to its simplicity, huge adoption and native support practically everywhere. In the context of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9081,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","rank_math_primary_category":null},"categories":[102,103],"tags":[],"ydw_autore":[85],"post_folder":[],"class_list":["post-827977","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","category-geo-and-ai-search","ydw_autore-davide-prevosto"],"_links":{"self":[{"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/posts\/827977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/comments?post=827977"}],"version-history":[{"count":1,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/posts\/827977\/revisions"}],"predecessor-version":[{"id":827978,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/posts\/827977\/revisions\/827978"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/media\/9081"}],"wp:attachment":[{"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/media?parent=827977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/categories?post=827977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/tags?post=827977"},{"taxonomy":"ydw_autore","embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/ydw_autore?post=827977"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/www.yourdigitalweb.com\/en\/wp-json\/wp\/v2\/post_folder?post=827977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}