{ } " , : and every repeated key name consumes a token.← → navigate samples when in Compare view.// Before — JSON String json = JsonIo.toJson(employees); // After — TOON (40% fewer tokens) String toon = JsonIo.toToon(employees, null); // Round-trip back to Java List<Employee> list = JsonIo.fromToon(toon, null) .asType(new TypeHolder<List<Employee>>(){});
// Add to pom.xml <dependency> <groupId>com.cedarsoftware</groupId> <artifactId>json-io-spring-ai-toon</artifactId> </dependency> // Annotate your tool method @Tool(description = "Look up employees", resultConverter = ToonToolCallResultConverter.class) List<Employee> findByDept(String dept) { ... }
| Records | json-io TOON | Python TOON (Rust/PyO3) |
Python JSON (C stdlib) |
|
|---|---|---|---|---|
| Read | 10,000 | 2.5 ms | 4.2 ms | 3.2 ms |
| 100,000 | 22 ms | 46 ms | 33 ms | |
| 1,000,000 | 218 ms | 488 ms | 352 ms | |
| Write | 10,000 | 2.3 ms | 11 ms | 2.9 ms |
| 100,000 | 26 ms | 108 ms | 30 ms | |
| 1,000,000 | 284 ms | 1,080 ms | 287 ms |
$id on first encounter, $ref on subsequent references.$type can be embedded in TOON output for polymorphic deserialization.{{ jsonText }}{{ toonText }}