{"slug": "toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half", "title": "TOON: the JSON trick that cut my LLM prompt tokens by half", "summary": "A developer created TOON, a compact data format that reduces LLM prompt tokens by 30-60% for repetitive JSON arrays by declaring keys once and listing values row by row. The format is designed for developers sending large arrays of similar objects to models like GPT or Claude, and a free browser-based converter is available at jsontoonpro.com.", "body_md": "I run a small developer tools site, and the whole thing started with one annoyance: sending JSON arrays to GPT or Claude wastes a ridiculous amount of tokens on repeated keys.\n\nLook at a typical API response:\n\n[\n\n{ \"id\": 1, \"name\": \"Alice\", \"role\": \"admin\", \"active\": true },\n\n{ \"id\": 2, \"name\": \"Bob\", \"role\": \"editor\", \"active\": true },\n\n{ \"id\": 3, \"name\": \"Carol\", \"role\": \"viewer\", \"active\": false }\n\n]\n\nThree records, and the keys id, name, role, and active appear three times each. Now imagine 500 records. You are paying your LLM provider to read the same four words 500 times.\n\nTOON is a compact format that declares the keys once, then lists values row by row:\n\nusers[3]{id,name,role,active}:\n\n1,Alice,admin,true\n\n2,Bob,editor,true\n\n3,Carol,viewer,false\n\nSame data. On my test sets this cuts tokens by 30 to 60 percent depending on how repetitive the data is. The bigger the array and the shorter the values, the bigger the saving, because keys make up a larger share of the payload.\n\nThe honest limitations\n\nIt only helps with arrays of similar objects. Deeply nested or mixed-shape data saves little or nothing.\n\nThe model needs one instruction line, something like: the following block is a compact table representation of JSON. Modern models handle it fine, but do not skip the hint.\n\nIf your prompt is mostly instructions and only a little data, the saving will not matter. This is for people stuffing hundreds of records into context.\n\nThe math\n\nSay you push 10 million input tokens a month through GPT-4o at 2.50 dollars per million. If 60 percent of that is tabular JSON and TOON cuts it by 45 percent, you save around 6.75 dollars per million on that share, roughly 480 dollars a year. Not life changing at small scale, but it compounds fast at higher volume, and it also frees context window, which is sometimes worth more than the money.\n\nI built a free converter that does JSON to TOON and back, shows a token estimate for both formats, and runs entirely in the browser: jsontoonpro.com. While building it I ended up adding about 50 other client-side tools (formatters, Base64, hash generators), but the TOON converter is still the reason the site exists.\n\nHappy to answer questions about the format or share the test data I used for the percentages.\n\n#llm #json #ai #webdev", "url": "https://wpnews.pro/news/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half", "canonical_source": "https://dev.to/wajeehaco/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half-5b0p", "published_at": "2026-07-12 16:54:40+00:00", "updated_at": "2026-07-12 17:16:04.090075+00:00", "lang": "en", "topics": ["large-language-models", "developer-tools", "ai-infrastructure"], "entities": ["TOON", "GPT-4o", "Claude", "jsontoonpro.com"], "alternates": {"html": "https://wpnews.pro/news/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half", "markdown": "https://wpnews.pro/news/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half.md", "text": "https://wpnews.pro/news/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half.txt", "jsonld": "https://wpnews.pro/news/toon-the-json-trick-that-cut-my-llm-prompt-tokens-by-half.jsonld"}}