Skip to content

Add TOON (Token-Oriented Object Notation) Support #4869

@maksymuimanov

Description

@maksymuimanov

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions