16 hours ago16 hr TOON: A Compact, LLM-Friendly Alternative to JSONJSON has become the universal data format for APIs, configuration, and data exchange. It’s precise, machine-friendly, and everywhere. But when JSON is fed into Large Language Models (LLMs), it’s not always ideal: braces, quotes, and repeated field names can waste tokens and obscure the structure that models need to reason about the data.That’s where Token-Oriented Object Notation (TOON) comes in. TOON is a compact, human-readable encoding of the JSON data model, designed specifically for LLM input. It is a lossless representation of JSON, meaning you can round-trip between JSON and TOON without losing information.What Is TOON?Think of TOON as a translation layer:Use JSON programmatically, as you always have.Encode it as TOON when sending structured data to an LLM.TOON combines two familiar ideas:YAML-style indentation to express nested objects without braces.CSV-style tables for uniform arrays of objects, declaring field names once and streaming values row by row.This makes structure easier for models to follow while significantly reducing token usage. In mixed-structure benchmarks, TOON achieved higher accuracy than JSON while using roughly 40% fewer tokens.Tip: TOON shines when you have arrays of objects with the same structure (for example, lists of people, products, or records). For deeply nested or highly irregular data, compact JSON may still be the better choice.Why TOON Is LLM-FriendlyTOON includes explicit guardrails that help LLMs parse and validate data:[N] length declarations for arrays{field1,field2,...} headers for tabular object arraysMinimal quoting and punctuationThe result is data that is easier for models to scan, reason about, and reproduce correctly.Introducing JSON.ToToon in the MBS FileMaker PluginWith version 16.1 of the MBS FileMaker Plugin for FileMaker, you can now convert JSON directly into TOON using the new JSON.ToToon function.This makes it trivial to take JSON you already generate in FileMaker and transform it into a compact, LLM-optimized format for prompts, API calls, or AI-assisted workflows.Function OverviewMBS( "JSON.ToToon"; JSON )JSON: A JSON text or JSON referenceResult: TOON text, or an error messageSimple ExampleLet’s start with a very small JSON object created in FileMaker:MBS( "JSON.ToToon"; JSONSetElement ( "{}" ; "hello" ; 123 ; JSONNumber ) )The resulting TOON output is:hello: 123No braces, no quotes, just the structure that matters.Tabular Example: Uniform ArraysHere’s where TOON really shows its strength. Consider this JSON:{ "people": [ { "first": "Christian", "last": "Schmitz", "city": "Nickenich" } ] }Converting it with JSON.ToToon:MBS( "JSON.ToToon"; "{\"people\":[{\"first\":\"Christian\",\"last\":\"Schmitz\",\"city\":\"Nickenich\"}]}" )Produces the following TOON:people[1]{first,last,city}: Christian,Schmitz,NickenichThe array length ([1]) and field list ({first,last,city}) are declared once, and each row becomes a simple, CSV-like line. This format is compact, readable, and easy for LLMs to process reliably.When (and When Not) to Use TOONTOON is a powerful tool, but it’s not a universal replacement:Great fit: Uniform arrays of objects, AI prompts, structured context for LLMsLess ideal: Deeply nested, non-uniform configuration dataPure tables: CSV is still smaller, but TOON adds helpful structureIf latency or performance is critical, we recommend benchmarking both JSON and TOON in your own environment and choosing what works best for your models and deployment.ConclusionTOON offers a practical, efficient way to represent JSON data for Large Language Models, reducing tokens while improving structural clarity. With the new JSON.ToToon function in the MBS FileMaker Plugin, FileMaker developers can adopt TOON immediately—no changes to existing JSON pipelines required.Use JSON where machines talk to machines. Use TOON where machines talk to models.
Create an account or sign in to comment