From JSON to Markdown: Reducing AI SEO Analysis Token Costs by 90%
AI SEO analysis pipelines usually run into two problems quickly. First, the more data you analyze, the more input tokens you send to the model. Adding more keywords, markets, competitors, pages, or result rows makes every prompt longer. That may not matter for a one-off analysis, but it matters whe

Posted on Oct 25 • Originally published at serpapi.com
AI SEO analysis pipelines usually run into two problems quickly.
First, the more data you analyze, the more input tokens you send to the model. Adding more keywords, markets, competitors, pages, or result rows makes every prompt longer. That may not matter for a one-off analysis, but it matters when a pipeline runs thousands of times a day.
Second, cutting the input down can make the analysis less useful. When the full dataset does not fit into the model context, you might often split it into batches, summarize each batch, or rely on agent memory. Those techniques help, but they can not replace the original data. If positions 1-10 and positions 21-30 land in different batches, the model may never compare them side by side.
The core question is simple: Can we help the model see more SEO evidence in the same token budget?
In this post, I will compare JSON and Markdown as API response formats. I will first reproduce a token benchmark for Google Shopping results. Then I will run a practical SEO analysis demo to see whether the larger sample changes the model's recommendation. The demo code is available here.
Existing SEO tools already provide rich datasets, dashboards, reports, and AI features. For many workflows, that is enough.
But internal SEO questions often depend on business context that a general-purpose SEO platform does not have. For example:
When you build your own AI SEO analysis pipeline, you can choose the market, device, timestamp, query set, and data source. You can also combine search data with internal business data before asking the model to reason over it.
The goal is not to rebuild a full SEO platform. The goal is to add a decision layer that matches your company's workflow.
Most APIs return JSON by default. JSON is excellent for code. It gives programs exact fields, predictable structure, and a reliable contract. But when the next consumer is an AI model, the response format also affects context usage. Consider a simplified Google Shopping result in JSON:
{ "shopping_results": [ { "position": 1, "title": "Trail Runner X", "price": "$89", "rating": 4.7 }, { "position": 2, "title": "Aero Sprint", "price": "$74", "rating": 4.5 } ] } Enter fullscreen mode Exit fullscreen mode The same information can be represented as a Markdown table:
## Shopping Results | Position | Title | Price | Rating | |---:|---|---:|---:| | 1 | Trail Runner X | $89 | 4.7 | | 2 | Aero Sprint | $74 | 4.5 | Enter fullscreen mode Exit fullscreen mode The JSON response repeats keys such as position, title, price, and rating for every item. It also includes quotes, commas, braces, and nesting. The Markdown table keeps the field names in the header and uses rows for the values. Both formats describe the same result set, but Markdown often uses fewer tokens. That means the same model context can fit more search results before batching becomes necessary.
This is why Markdown is moving beyond documentation. In April 2025, Cloudflare added a Browser Rendering API endpoint that converts webpages into Markdown. In February 2026, Notion documents page content access as Markdown in its data APIs. In August 2026, SerpApi supports Markdown output for search results by using output=md.
The shared pattern is clear: API responses are no longer consumed only by programs. They may go directly into an AI agent's context.
SerpApi published a Markdown output benchmark comparing JSON and Markdown responses across several APIs. The result depends on the API, query, returned fields, and tokenizer, but the largest savings appear in more complex result sets. In that benchmark:
These numbers compare input tokens only. If a model provider charges the same price per input token, reducing input tokens reduces that part of the cost. The total cost of a full AI pipeline will still depend on model choice, output length, orchestration, retries, caching, and other API calls. I wanted to reproduce the Google Shopping result with my own code.
The reproduction changes only one variable: response format. I prepared 12 Google Shopping queries. For each query, I used the same location, language, and device settings. Then I requested the same Google Shopping results twice through SerpApi: once as JSON and once as Markdown.
I sent the raw API responses to the same DeepSeek model and read usage.prompt_tokens from the DeepSeek API response. That value reports the actual number of input tokens the model received. I disabled thinking mode because this experiment measures input representation, not reasoning quality. I did not ask DeepSeek to solve an SEO problem in this benchmark. I used it as the token accounting endpoint.
saving = 100 * ( 1 - markdown_tokens / json_tokens ) Enter fullscreen mode Exit fullscreen mode Let's execute it:
Across the 12 queries, Markdown reduced input tokens by an average of 89.55%. Individual queries ranged from 86.59% to 91.20%. That closely matches the published Google Shopping benchmark of about 90%.
The run saves intermediate evidence so the result can be checked later:
For this sample, Markdown compressed the Google Shopping inputs to roughly one-tenth of the JSON token usage.
The next question is more important for AI SEO: if Markdown lets the model see more results in the same budget, can that change the analysis?
For the second experiment, I used a practical Google Shopping question: I sell trail running shoes. To show up higher in Google Shopping, should I optimize titles, lower prices, or get more reviews?
SerpApi returned the same Google Shopping snapshot with 30 products. Python then measured how many products could fit into the 1550-token budget for each format.
With the same token budget, Markdown let DeepSeek see 1.88x more products.
The JSON sample only covered positions 1-16. In that sample, the average query-term coverage in product titles was:
That difference was small. DeepSeek treated the title signal as weak and did not see titles as a clear explanation for position. The Markdown sample covered all 30 products. With the full sample, the title pattern became clearer:
With the additional 14 products, DeepSeek gave a more specific recommendation: test title changes for lower-position products by adding terms such as "trail running" and gender-specific modifiers. Price and review count did not show meaningful rank relationships in this snapshot:
So the supported next step was not to cut prices or chase more reviews for ranking. The better next step was to run a title A/B test.
This does not prove that title changes cause higher Google Shopping positions. A single search snapshot can only generate hypotheses. But it does show how a compact response format can expose a signal that a smaller sample hides.
Markdown did not make the model smarter. It gave the model more original evidence to compare in the same context budget.
This is not a case for replacing JSON everywhere. JSON remains the better format when code needs a strict contract: tool arguments, IDs, status fields, saved state, validation, and orchestration logic. Markdown is useful when the next step is model understanding. If an AI agent needs to read, compare, summarize, or reason over search results, Markdown can preserve a clear structure while reducing token overhead.
A practical agent workflow can use both:
First, building an AI SEO pipeline gives teams control over what the model sees and how recommendations get tested. The value comes from connecting search data with the business question, not from rebuilding a full SEO platform.
Second, Markdown can reduce input token usage substantially for search result payloads. In our Google Shopping benchmark reproduction, Markdown reduced input tokens by 89.55% on average.
Third, a more compact input format can change the model's answer by increasing evidence coverage. In the Shopping demo, JSON fit 16 products while Markdown fit all 30. The larger sample changed the title signal and led DeepSeek to recommend testing title relevance first.
If you are building an AI agent or AI SEO pipeline, test both formats in one real workflow. Compare:
File size alone is not enough. What matters is how much useful evidence the model can see when it makes the decision.
SerpApi supports Markdown responses for search APIs with output=md. If your workflow sends search results into an LLM or AI agent, this can reduce formatting overhead and help the model analyze more results in one context. You can try SerpApi with a free account, which includes 250 searches per month. If you have questions or feedback about Markdown responses, contact us at contact@serpapi.com.