TL;DR: Code-quality issue output can be emitted as TOON instead of JSON to reduce the token cost of feeding data into AI agents, while preserving the same information and enabling measurement of the savings on real payloads, according to Sonar. The broader point is that agent efficiency depends as much on data shape as on data volume, and structured outputs now belong in governance conversations.
NHIMG editorial — based on content published by Sonar: TOON format cuts token costs in AI issue output
Questions worth separating out
Q: How should security teams decide whether to use TOON or JSON for AI agent input?
A: Use TOON when the data is uniform, repetitive, and consumed by a machine that benefits from reduced structural noise.
Q: Why do structured tool outputs affect AI agent cost so much?
A: Because agents pay for repeated field names, punctuation, and schema verbosity every time they ingest a payload.
Q: What breaks when teams compress data for agents too aggressively?
A: Loss of fidelity, broken parsers, and ambiguous records.
Practitioner guidance
- Standardise compact output for uniform machine-readable records Use TOON or a similar compact encoding for issue lists, dependency findings, and other repetitive records that AI agents consume frequently.
- Measure token savings on real payloads before changing defaults Run representative Sonar outputs through a token-savings workflow and compare results on the data your agents actually use.
- Treat output schema as part of AI workflow governance Document which tools may emit compact formats, which consumers can parse them, and how validation will be handled before data reaches an LLM context window.
What's in the full article
Sonar's full article covers the implementation detail this post intentionally leaves at the analytical level:
- Measured TOON versus JSON token counts on representative Sonar issue payloads, including the exact workflow used to reproduce the comparison
- Step-by-step CLI examples for converting `sonar list issues` output into TOON for agent consumption
- Guidance on when TOON is the better fit than JSON for different data shapes and consumer types
- Sonar-specific context around Context Augmentation and cleaner code as complementary token-saving levers
👉 Read Sonar's analysis of TOON format for AI issue output →
TOON issue output: what it means for AI code agents?
Explore further
Token efficiency is becoming part of AI governance. When agents consume tool output at scale, the format of that output affects operating cost, latency, and how much context is available for the next task. That makes token management a programme issue, not just a developer convenience, because format choices influence how reliable and economical AI-assisted workflows become.
A question worth separating out:
Q: How can teams govern AI context without slowing engineering workflows?
A: Set rules for which tools may emit compact output, define the consumers that can parse it, and validate the round-trip back to the original data model. That lets teams reduce token use while keeping automation auditable and predictable, which is the real governance requirement.
👉 Read our full editorial: TOON format cuts agent token costs in Sonar issue output