Structured Data's Token Tax: JSON & Code

Structured data types such as JSON objects and code snippets consume a disproportionately high number of tokens due to granular tokenization (e.g., every brace, bracket, and indentation), making them less efficient and more costly than natural language prose in an AI agent's context window.

Sources

Open the full topic