JSON vs Markdown SERPs: we measured tokens
When an agent calls a search tool, the whole response lands in the model's context. You pay for every token, and the model has to read past every one of them to find the three links that matter. So the format of a SERP response is not a detail: it is a cost line and a quality lever. We took one Google results page and rendered it three ways. These are estimates on a single sample , not a…
When a search agent queries a search tool, the entire response is passed into the model's context. Each token incurs a cost, and the model must process every token to locate the pertinent links. Consequently, the format of the SERP response is not merely an aesthetic choice; it directly impacts cost and quality. In this experiment, we rendered a Google results page in three different formats: JSON, pretty JSON, compact JSON, Markdown, and full JSON.
These assessments are based on a single sample, not a benchmark. The sample included an answer box, three organic results, two People Also Ask questions, and three related searches. Tokens are estimated at around 4 characters per token. Note that actual pages may be larger and different tokenizers exist. The crucial takeaway is the relative token counts.
JSON rendered in a pretty format contains 668 tokens, while compact JSON is about 248 tokens, representing a 63% reduction. Markdown is approximately 240 tokens, which is 64% smaller than pretty JSON. On a full, unfiltered Google SERP as JSON, the token count can reach roughly 24,700 tokens, making the format choice a significant factor in cost.
Most of a JSON SERP consists of structure rather than content, with repeated keys, quotes, braces, indentation, and unused fields. Minifying JSON reduces whitespace but retains all keys. Compact JSON shortens keys and omits fields rarely used by agents. This format is suitable for programs consuming the output or when the tool schema requires structured fields.
Markdown, on the other hand, converts the page into prose with numbered links. Models read Markdown like any other document, maintaining citation URLs. If an agent only needs titles, links, and the knowledge graph, they can request only those fields: { "q": "best espresso machine 2026", "fields": "results.title,results.link,knowledge_graph" }.
Tracking estimated token counts per call is advised, as this information is provided in the X-Tokens-Estimate response header. Based on our findings, we recommend agents read results directly in Markdown, while code processes them with compact JSON or field projection. Full JSON should be retained when all fields are needed. We implemented this approach in SerpKite, a Google SERP API for AI agents, where all three formats cost the same (1 credit per page).
Test these formats on your own queries using the SERP token counter, and consult the documentation for API parameters. Always measure your own pages before choosing a format.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.