JSON-LD and Structured Markup Extraction From Web Pages
JSON-LD markup cuts extraction costs by skipping rendering and LLM parsing.

JSON-LD puts named, typed data inside the HTML, giving AI pipelines a fast path that avoids unnecessary rendering and LLM parsing. An extraction cascade takes those facts first, validates them, and uses more expensive methods only for what is missing.
Why web data extraction has a hidden fast path that most AI pipelines ignore
Pipeline costs balloon and latency becomes unacceptable when every page takes the expensive route. The default assumption is that a page must be fetched, rendered, and passed to an LLM before it yields useful data. Yet raw HTML brings scripts, styles, and navigation into the model’s input before extraction even starts. Much of that material says nothing about the facts the pipeline needs. The system pays to process noise before it can find the signal.
Many e-commerce, news, and event pages have JSON-LD blocks that name their properties and declare their entity types. Extracting those blocks takes a DOM query followed by ordinary JSON parsing. That avoids the token cost of interpreting HTML and the overhead of rendering when the blocks are already in the page source. What matters is whether facts are already structured or still need extraction, regardless of how easy or difficult the website is to work with.
That distinction changes the first question a pipeline asks. Instead of deciding how to interpret the whole page, it checks whether the required data has already been supplied. JSON-LD removes a layer of work where the markup is present and usable, which is enough to justify checking for it early.
Where JSON-LD sits in the extraction cascade and why that position matters
An extraction cascade orders methods by cost and reliability. Direct API or XHR calls come first, followed by embedded JSON, then HTML parsing, rendering, and finally LLM extraction. JSON-LD belongs to the second tier, together with Next.js data, hydration blobs, and article metadata already shipped in HTML. Its position matters more than its popularity as a format. It gives the pipeline a cheap, deterministic way to get data before it tries methods that interpret the page or use a browser.
The cascade is therefore an architecture decision. Teams that jump straight to browser rendering for every request can overspend by an order of magnitude. The alternative is to inspect the page source for <script type="application/ld+json"> blocks before writing page-specific extraction code. When those blocks contain the needed fields, there is no reason to reconstruct the same facts from display markup. A stable script-type query replaces selectors tied to the page’s visual layout.
When the embedded data is absent or insufficient, the cascade moves down to HTML parsing and then to more expensive methods as needed. Each move should address only gaps left by the previous tier. The LLM tier has a narrow role, including one-off cleanup from small pages, screenshots, or PDFs. It is not a route for accepting unverified production data or financial facts.
What JSON-LD actually contains and how the Schema.org vocabulary maps to AI-usable data
JSON-LD is useful because its structure has shared meaning. Schema.org supplies a vocabulary of entity types and properties that LLMs can recognize. Its types include Organization, Product, Article, FAQPage, HowTo, and Event. Those names tell a downstream system what kind of thing it is reading, and the properties tell it the facts about that thing. The model receives labeled values rather than prose from which it must infer both the value and its role.
An Organization entity provides a simple example. Its @type identifies it as an Organization, and its knowsAbout property signals the topics associated with its authority. On a Product entity, offers can hold the pricing information needed to compare purchases without rendering the pricing page. These properties make the publisher’s claims explicit enough to extract, validate, and compare.
Nested relationships add another layer of value. An agent can follow a Product through its manufacturer to an Organization, then through its founder to a Person. JSON-LD also keeps this structure separate from the page’s presentation by placing it in its own script block. Microdata and RDFa instead put schema in HTML element attributes, where extracting it can become entangled with processing rich text.
How to locate and extract JSON-LD blocks from a page in practice
The extraction operation starts with the HTML. Find all script elements whose type is application/ld+json, then read the text content of each one. In JavaScript, parse that text with JSON.parse(), or use json.loads() in Python. Parsing produces native data with named properties that the pipeline can use directly. The query targets the markup format rather than a changing CSS path.
Finding all matching elements matters because a page can contain several blocks. An Organization block may be in the head while a Product or Article block is in the body. Collect the parsed results into an array and filter by @type to isolate the entities the job needs. Some pages put several entities in one block under an @graph key. Check for that key and iterate its contents rather than treating the whole block as a single entity.
Parsing is only the first gate. Check the extracted data against Schema.org definitions or use a library with built-in schema validation to catch blocks that are malformed or have parts missing. A block that parses successfully can still omit a required property. Keep useful fields from markup that has parts missing, then use HTML parsing to fill the gaps.
Absence also deserves a recorded result. Log pages without JSON-LD so recurring jobs can skip the check on pages known to contain only bare HTML and move to the next tier. A scraping API can take care of HTTP clients, rendering environments, and anti-bot handling while returning extracted JSON-LD as structured output. The pipeline still needs to decide which entities it needs and whether their fields have enough data.
Feeding extracted JSON-LD into AI pipelines: grounding RAG and agent reasoning with typed facts
Embedding-based RAG can retrieve only from documents already indexed. That creates a freshness problem when facts change faster than the indexing cadence. Prices, library versions, regulations, and CVEs can change while the retrieval system still has the old information. A live fetch addresses that gap at query time. When the page contains useful JSON-LD, the fetch can return structured facts rather than another document for the model to interpret.
A product page shows the payoff clearly. An agent can extract pricing from offers, availability from availability, and ratings from aggregateRating. These are the values the page supplies at capture time, with labels that identify their meaning. Deterministic extraction reduces the chance that the model will turn an ambiguous phrase into the wrong fact. It does not, however, establish that the page itself is accurate or up to date.
Linked entities give the agent a way to examine relationships as well as individual values. A Product linked to its manufacturer and Organization provides a graph for cross-referencing. The model can reason over the extracted structure without first rebuilding it from paragraphs. For the structured-data portion of the page, no HTML-to-Markdown conversion is needed. The extraction itself consumes no LLM tokens, and the model receives the relevant data.
This also fits the tool-use pattern used by agents. A server supporting agent tool use can expose a URL-to-structured-data tool that accepts the entity type the agent needs, fetches the page, and returns the relevant JSON-LD. Developer code invokes a traditional scraping API, while an LLM can invoke a tool exposed by such a server during its reasoning loop. The same extraction integration can therefore support both scheduled jobs and autonomous agents.
Where JSON-LD extraction falls short and what to do when it does
The strongest objection is straightforward. Some pages have no JSON-LD, and others have JSON-LD without useful data. Coverage is strong on e-commerce, news, and event pages but weaker on SaaS product pages, internal tools, and custom web applications. Those weaker areas can be exactly where an AI pipeline needs to work. A design that stops at JSON-LD is therefore incomplete, even if its first step is sound.
Present markup can fail in several ways. Properties may be missing required fields, dates may be in non-ISO formats, and @type values may not match what is on the page. Some sites inject schema through client-side code, making it invisible to a scraper that does not render the page. AI systems also do not always interpret schema semantically just because it exists. Clean syntax helps, but it does not prove that grounding worked.
Volpini et al. (2026) found that entity content that readers could see and navigate in the page body improved RAG accuracy by approximately 30% compared with plain HTML, while JSON-LD markup alone helped only a little. That finding limits the claim that markup by itself is decisive. It does not erase the value of extracting typed fields cheaply. The finding makes schema a complement to clear body text.
The practical response is to measure coverage across the target domains and invest earlier in HTML parsing or schema-driven extraction where coverage is low. For the latter, pass cleaned Markdown and a developer-defined JSON schema to an LLM or extraction API. Strip scripts, styles, and navigation before an LLM call so the model reads the text it needs without those parts of the page. This fallback can produce a comparable output shape at higher cost, subject to validation.
Building a production extraction pipeline that starts with JSON-LD and handles everything else
Once the cascade reaches a page rather than a direct data endpoint, begin with a plain HTTP GET. Route pages already known to require JavaScript rendering to a headless browser or a scraping API that handles it. Query all JSON-LD script elements, parse and validate the blocks, and filter them to the required entity types. Log coverage per domain so the fast path’s usefulness is measurable.
Next, check that the data has the properties the job expects. If required fields are missing or values fail checks against the page content, mark the record as incomplete and route it to the fallback tier. Keep valid extracted fields. Where LLM extraction is needed, remove scripts, styles, and navigation, convert the remaining HTML to Markdown, and supply the target JSON schema. Data from that fallback still has to pass verification.
Normalize the extracted fields into one record with a consistent schema. Attach the source URL, capture timestamp, extraction method, and parser version so the result can be audited. Then route records to warehouses, RAG indexes, webhook queues, or agent memory stores. Downstream consumers should not need separate handling for every extraction method.
Monitor domain-level JSON-LD coverage over time, since a sudden drop can signal a redesign or schema removal. For competitor pricing, product changelogs, and documentation, run the cascade on a schedule and compare normalized records. This leaves out page noise and shows the changes that matter in typed fields. The production pattern is simple, which is to take the structure already supplied, validate it, and pay for more extraction only where a real gap remains.


