← Back to Blog

Does Asking for JSON Cost More? Output Format and Your Token Bill

By Eric Bush · July 15, 2026 · 6 min read

Black dice with white pips tossed in the air against a blurred neon backdrop

Format Is Tokens, and Tokens Are Money

When you ask an AI model to "return the result as JSON" or "format this as a Markdown table," you are not just choosing how the output looks — you are choosing how many output tokens the model generates. And since output tokens are the most expensive part of most API bills (often 4–5x the input rate), the format you request has a direct, measurable effect on cost.

The difference is not huge on a single call, but it compounds. If every response in a high-volume pipeline carries 20% of avoidable structural overhead, you are paying a 20% tax on your entire output bill. For a coding agent generating structured data thousands of times a day, that adds up.

Comparing the Formats

Every format spends tokens on structural characters — the "syntax tax" that carries no semantic payload. Here is roughly how the common ones stack up for the same data:

  • Plain text / prose: the leanest for freeform content — no delimiters, no keys. But it is not machine-parseable, so it only works when a human reads the output.
  • Markdown: very light. A few characters for headers, bullets, and table pipes. Excellent balance of structure and low overhead.
  • JSON: moderate overhead. Every value carries quotes, keys are repeated on every object, and braces and commas add up — especially in arrays of similar objects where the same keys repeat hundreds of times.
  • XML: the heaviest. Every field is wrapped in an opening and closing tag, so tag names are paid for twice per value. Verbose tag names multiply the cost.

A rough rule of thumb: for the same structured data, XML often costs noticeably more output tokens than JSON, and JSON costs more than an equivalent Markdown table or CSV. The gap widens as the data gets more repetitive, because repeated keys and tags are pure overhead.

A Worked Example

Say you ask a model to return 100 records, each with five fields. In JSON, every one of those 100 objects repeats all five field names, plus quotes, colons, commas, and braces. That is 500 repetitions of your key names — pure structural cost. The same data as a CSV names each field once in a header row, then sends only the values. For repetitive tabular data, the CSV can use a fraction of the output tokens.

At a premium output rate — say $25 or $30 per million tokens — trimming thousands of output tokens per call across a high-volume workload turns into real monthly savings. The model did the same reasoning either way; you just paid less to transmit the answer.

Choosing the Cheapest Format That Works

Cost is not the only consideration — you need a format your downstream code can actually consume. The practical guidance:

  • Tabular, repetitive data? Prefer CSV or a Markdown table over JSON — you avoid repeating keys on every row.
  • Need machine parsing with nesting? Use JSON, not XML — same structure, fewer tokens.
  • Output is for a human? Markdown or plain prose is both cheaper and more readable than forcing JSON.
  • Use short, consistent keys. If you must use JSON, "id" beats "identifier" when it repeats thousands of times.

Don't force structure you don't need. A common anti-pattern is demanding elaborate JSON for output a human will read once — you pay the syntax tax for nothing. Match the format to the consumer.

Want to see how output-token savings translate to dollars at your volume? Plug your expected output size and call frequency into the AI Cost Estimator and watch how a leaner format changes the monthly total.

Want to calculate exact costs for your project?

Frequently Asked Questions

Does the output format I request change my AI token cost?

Yes. The format determines how many output tokens the model generates, and output tokens are typically the most expensive part of the bill (often 4–5x the input rate). Verbose formats like XML cost more than JSON, and JSON costs more than an equivalent Markdown table or CSV for the same data.

Which output format is cheapest for AI coding tasks?

For repetitive tabular data, CSV or a Markdown table is cheapest because field names appear once instead of repeating on every record. For machine-parseable nested data, JSON beats XML. For human-readable output, plain prose or Markdown is both cheaper and more readable than forced JSON.

Why does JSON cost more tokens than CSV for lists?

In JSON, every object in an array repeats all its field names plus quotes, colons, commas, and braces. For 100 records with five fields, that's 500 repetitions of your keys as pure structural overhead. CSV names each field once in a header row, then sends only values.

How can I reduce output-format token overhead?

Match the format to the consumer: use CSV or Markdown tables for tabular data, JSON instead of XML when you need parsing, and plain prose for human-read output. If you must use JSON, use short consistent keys — 'id' beats 'identifier' when it repeats thousands of times.