Skip to content
Back to Blog
TechnicalStructured DataAI Agents

JSON-LD vs Microdata: Which Format Agents Prefer

Agent Checker4 min read

Structured data comes in three flavours: JSON-LD, Microdata, and RDFa. All three can describe the same information using Schema.org vocabulary. But agents have a clear preference, and it comes down to how much work they have to do to extract the data.

JSON-LD: a single block, no DOM required

JSON-LD sits in a <script> tag in the document head (or body). It is plain JSON with a few extra properties for context. An agent can extract it without touching the DOM at all.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Ergonomic Office Chair",
  "offers": {
    "@type": "Offer",
    "price": "299.00",
    "priceCurrency": "GBP",
    "availability": "https://schema.org/InStock"
  }
}
</script>

The agent parses this as JSON. No HTML traversal needed. No matching element IDs or following itemprop chains through nested elements. The data is self-contained.

Microdata: embedded in the HTML

Microdata weaves structured data directly into your HTML using itemscope, itemtype, and itemprop attributes.

<div itemscope itemtype="https://schema.org/Product">
  <h1 itemprop="name">Ergonomic Office Chair</h1>
  <div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
    <span itemprop="price" content="299.00">£299</span>
    <meta itemprop="priceCurrency" content="GBP" />
    <link itemprop="availability" href="https://schema.org/InStock" />
  </div>
</div>

To extract this, an agent needs to walk the DOM tree. It has to find elements with itemscope, collect their itemprop children, handle nested scopes, and resolve content attributes versus text content. That is significantly more work than parsing a JSON block.

RDFa: the third option nobody uses

RDFa uses typeof, property, and vocab attributes on HTML elements. It is technically capable, but adoption is low. Fewer than 5% of sites with structured data use RDFa as their primary format. Most agents have better JSON-LD and Microdata support simply because those formats appear far more often in the wild.

Why agents prefer JSON-LD

Three practical reasons:

Separation from presentation. JSON-LD does not depend on your HTML structure. You can completely redesign your page layout without breaking the structured data. With Microdata, a template refactor can accidentally remove or reorder itemprop attributes.

Easier to validate. JSON-LD is valid JSON. Any JSON parser can check the syntax. You can use structured data testing tools to verify it, or simply drop it into a JSON validator. Microdata validation requires rendering the page and then extracting the data from the DOM, which is a more complex process.

Multiple entities in one block. JSON-LD supports @graph arrays, letting you describe multiple entities (a product, an organisation, a breadcrumb list) in a single script tag. With Microdata, each entity needs its own DOM subtree, which can make your HTML harder to maintain.

When Microdata still makes sense

Microdata is not without advantages. If your structured data is tightly coupled to visible page content, Microdata ensures they stay in sync. A price displayed on the page and marked up with itemprop="price" is, by definition, the same value. With JSON-LD, the visible price and the JSON-LD price are separate, and they can drift apart if someone updates one but not the other.

Content management systems that generate both HTML and structured data from the same data source sometimes find Microdata simpler to implement. The CMS outputs the HTML with attributes attached, and there is no separate JSON-LD template to maintain.

Practical guidance

For most sites, JSON-LD is the right choice. Here is a reasonable approach:

  1. Use JSON-LD for all new structured data implementation
  2. If you have existing Microdata that works, there is no urgent need to migrate. Both formats are valid.
  3. Do not mix formats for the same entity on the same page. Pick one.
  4. Test your structured data with both Google's Rich Results Test and a plain JSON validator
  5. If your HTML structure changes frequently, JSON-LD protects your structured data from those changes

The format matters less than having structured data at all. But given the choice, JSON-LD requires less effort from agents, which means they extract your data more reliably. If you want to see how well agents can read your current markup, check how agents experience your site and look at the structured data findings.