JSON indented for a human reader
Pretty-printing JSON in a prompt adds 20-30% tokens for whitespace nobody reads.
Indented JSON is easier for a person to scan, which is why it ends up in prompts: somebody copied it out of an API response viewer. The model parses minified JSON exactly as well.
The overhead is whitespace, and whitespace is proportional to nesting depth times line count. On a deeply nested schema it is commonly a quarter of the block. On a large embedded config it can be a third.
Minify it at the boundary rather than in the source, so the version in your repository stays readable and the version on the wire stays cheap. One `JSON.stringify(value)` without the indent argument is the whole fix.
{
"priority": {
"type": "string",
"enum": ["low", "high"]
}
}{"priority":{"type":"string","enum":["low","high"]}}Check your own prompt
The analyser checks this pattern along with the other 25, prices each finding against your request volume, and hands back a rewritten prompt. It runs in your browser — nothing is uploaded.
Run the analyserMore on tools & schemas
- A JSON schema written out in EnglishDescribing your output shape in prose costs more than declaring it, and works less well.
- What your tools cost before anyone calls oneTool schemas are re-sent on every request, plus a provider system prompt you never see.
- Tool schemas carrying dead weightLong descriptions, JSON Schema boilerplate, and enums with a hundred values.