Back to browse
GitHub Repository

Convert Java to JSON/TOON and back. Supports complex object graphs, cyclic references, and TOON format for 40-50% LLM token savings

385 starsJava

JSON-io – Java library for JSON, JSON5, and TOON (40% fewer LLM tokens)

by jdereg·Mar 24, 2026·1 point·0 comments

AI Analysis

●●SolidBig BrainNiche Gem

TOON format cuts LLM token costs 40-50%, but this is just Java support for an existing format.

Strengths
  • Handles cyclic object graphs and polymorphic types Jackson/Gson cannot
  • Zero-config serialization for 60+ built-in Java types out of the box
  • Arrays of uniform objects automatically become CSV-like tables
Weaknesses
  • TOON format itself is the innovation, this library is just Java implementation
  • Narrow scope limits appeal to Java developers specifically
Target Audience

Java developers building LLM applications

Similar To

Jackson · Gson · JToon

Post Description

I built TOON support into json-io, a Java serialization library. TOON is an indentation-based format designed for LLM applications where every token costs money and eats context window.

Same data as JSON, ~40-50% fewer tokens. No braces, brackets, commas, or unnecessary quoting. Arrays of uniform objects become CSV-like tables automatically.

JSON: {"team":"Rockets","players":[{"name":"John","age":30},{"name":"Sue","age":27}]}

TOON: team: Rockets players: name, age John, 30 Sue, 27

json-io reads/writes JSON, JSON5, and TOON with 60+ built-in Java types, cycle support, and zero config. There's also a Spring Boot starter and Spring AI module.

GitHub: https://github.com/jdereg/json-io TOON spec: https://toonformat.dev Baeldung article: https://www.baeldung.com/java-json-toon-format-libraries

Similar Projects

Developer Tools●●Solid

MAKO – Open protocol for LLM-optimized web content (93% fewer tokens)

MAKO compresses what matters into a HEAD-friendly payload — frontmatter, declared actions and semantic links — so agents can find relevance without downloading 181KB of navigation, ads and scripts. The project ships a spec plus real tooling (typed SDK, Express middleware, an analyzer/score and edge-friendly /md conversion), which is a rare combo of protocol thinking and usable developer ergonomics. Whether it becomes a standard depends on buy-in from CMS/plugin authors and agent platforms, but technically it's a smart, practical swing at an obvious pain point.

Big BrainSlick
juanisidoro
113mo ago