spring-projects / spring-projects/spring-ai
Add TOON (Token-Oriented Object Notation) Support
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Expected Behavior
Spring AI should support the TOON format as a serialization option when sending structured data to LLM models.
Example usage:
ExampleObject exampleObject = new ExampleObject();
String response = chatClient.prompt()
.mapper(toonMapper) // <-- the TOON mapper bean
.user(exampleObject)
.call()
.content();
This would allow applications to use TOON instead of JSON/YAML for model inputs, improving efficiency and reducing token count.
Current Behavior
Spring AI currently supports JSON and YAML (via built-in or user-provided serializers), but there’s no native TOON support.
Developers must manually serialize/deserialize TOON data and integrate it into prompts or function-calling logic.
Context
- TOON (Token-Oriented Object Notation) is a compact, token-efficient format designed for LLM input/output.
- Article reference:
- Benefits of adding TOON support:
- Reduces token usage and improves prompt window efficiency.
- Provides native serialization/deserialization similar to JSON/YAML.
- Makes it easier to handle structured POJO exchanges with LLMs.
- Workarounds exist (manual TOON serialization), but a built-in module would provide first-class support aligned with Spring AI’s extensibility model.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files, tests, or an existing entry point; start by locating Spring AI's JSON/YAML serialization integration and prompt mapper support. Review the referenced TOON libraries and define the module boundaries and compatibility expectations before implementation. Done means applications can use native TOON serialization and deserialization for structured model inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100