Skip to content

JSON-LD vs Microdata vs RDFa: which structured data format

JSON-LD vs Microdata vs RDFa: what Google and Bing document, the same product in all three syntaxes, and the practical trade-offs before you choose or migrate.

By Crawlito · 8 min read

In short

  • Google supports JSON-LD, Microdata and RDFa, says all three are equally fine when the markup is valid, and recommends JSON-LD if your site's setup allows it.
  • Bing announced JSON-LD support in July 2018 and said its Markup Validator covered Schema.org, HTML Microdata, Microformats, Open Graph and RDFa.
  • Microdata and RDFa live in attributes on the visible HTML, so every template change can break them; JSON-LD sits in one script block that can be generated from data.
  • The JSON-LD 1.1 specification says a processor extracting a page's JSON-LD as RDF must merge every application/ld+json block into one dataset, but no specification or Google page says how a JSON-LD item and a Microdata item for the same thing are reconciled.
  • If you migrate, describe each entity in one format only, and check the raw HTML with curl as well as the Rich Results Test.
On this page

For new work, use JSON-LD. Google supports all three formats, says they are "equally fine" as long as the markup is valid and properly implemented per each feature's documentation, and recommends JSON-LD if your setup allows it. Microdata and RDFa still work, so there is no need to rip out valid markup in a hurry, but they tie your structured data to the visible HTML, which makes them harder to maintain at scale and easy to break during a redesign.

This post shows the same product in all three syntaxes, compares the practical trade-offs and covers the case most guides skip: a page where two formats describe the same thing. If you are still deciding whether structured data is worth adding at all, read structured data for AI search: what helps and what is hype first. If your JSON-LD fails to parse, common JSON-LD errors has the fixes.

What Google and Bing document about each format

Google's introduction to structured data lists three supported formats and marks JSON-LD as recommended:

FormatHow Google describes it
JSON-LD (recommended)A JavaScript notation in a <script> tag, "not interleaved with the user-visible text", which makes nested items easier to express
MicrodataAn HTML specification for nesting structured data within HTML content, typically in the <body> but usable in the <head>
RDFaAn HTML5 extension using attributes on the tags of user-visible content, commonly in both the <head> and <body>

Two other statements on the same page matter for the choice. Google calls JSON-LD "the easiest solution for website owners to implement and maintain at scale", and it says it "can read JSON-LD data when it is dynamically injected into the page's contents". Neither that page nor Google's general structured data guidelines say whether a page may mix formats, or how mixed formats are combined.

Bing's position is older and less detailed. In a July 2018 Bing Webmaster blog post, Bing announced JSON-LD support in Bing Webmaster Tools and said its Markup Validator supported six markup languages, naming Schema.org, HTML Microdata, Microformats, Open Graph and RDFa. Bing's structured data help page loads its content with JavaScript, and we could not read a current format list from it, so treat the 2018 post as the latest first-party statement we could verify. It states no preference between formats.

The AI search operators outside Google and Bing do not document a preferred format either. The crawler documentation from OpenAI, Anthropic and Perplexity does not mention structured data at the time of writing, so the choice is about Google, Bing and your own maintenance costs.

The same product in JSON-LD, Microdata and RDFa

All three formats can express the same schema.org data. Here is one product with a name, an image and an offer, written each way. Note how much of the Microdata and RDFa versions is the visible page itself.

JSON-LD

html
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "@id": "https://example.com/products/oak-table#product",
  "name": "Oak dining table",
  "image": "https://example.com/img/oak-table.jpg",
  "offers": {
    "@type": "Offer",
    "price": "1299.00",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock"
  }
}
</script>

The block can sit anywhere in the document, and the visible HTML does not change. The JSON-LD 1.1 specification calls this a data block: the script element with type="application/ld+json" holds data, not code.

Microdata

html
<div itemscope itemtype="https://schema.org/Product"
     itemid="https://example.com/products/oak-table#product">
  <h1 itemprop="name">Oak dining table</h1>
  <img itemprop="image" src="/img/oak-table.jpg" alt="Oak dining table">
  <div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
    <meta itemprop="priceCurrency" content="USD">
    <data itemprop="price" value="1299.00">$1,299.00</data>
    <link itemprop="availability" href="https://schema.org/InStock">
    In stock
  </div>
</div>

The HTML Standard's microdata section decides each value by element type: a meta element gives its content attribute, img gives its src resolved to an absolute URL, a and link give href, data and meter give value, time gives its datetime, and most other elements give their text. That is why the price uses a data element: the visible text $1,299.00 has a symbol and a thousands separator, which schema.org's price guidance asks you to keep out of the value.

RDFa

html
<div vocab="https://schema.org/" typeof="Product"
     resource="https://example.com/products/oak-table#product">
  <h1 property="name">Oak dining table</h1>
  <img property="image" src="/img/oak-table.jpg" alt="Oak dining table">
  <div property="offers" typeof="Offer">
    <meta property="priceCurrency" content="USD">
    <span property="price" content="1299.00">$1,299.00</span>
    <link property="availability" href="https://schema.org/InStock">
    In stock
  </div>
</div>

RDFa Lite 1.1, a W3C Recommendation, defines five attributes: vocab, typeof, property, resource and prefix. The content attribute used for the price comes from full RDFa 1.1, not the Lite subset. The schema.org getting started guide teaches Microdata and notes that most examples on schema.org are also shown in RDFa and JSON-LD.

How the formats differ in practice

The data model is the same. The differences are about where the markup lives and who has to keep it right.

ConcernJSON-LDMicrodataRDFa
Where it livesOne <script> blockAttributes on visible elementsAttributes on visible elements
Coupling to the HTMLNone: layout changes do not touch itTight: moving or removing an element drops a propertyTight, same as Microdata
Generating from dataSerialize an object from your CMS or databaseEvery template must carry the attributesEvery template must carry the attributes
NestingNested objects in JSONNested itemscope elements, or itemrefNested typeof elements
Identifiers for linking entities@iditemidresource
Adding it with JavaScriptGoogle says it reads injected JSON-LDPossible, but means editing the DOMPossible, but means editing the DOM
Risk of drifting from the pageHigher: values are a copyLower: values are often the visible textLower, same as Microdata

Two rows deserve more than a cell.

Coupling cuts both ways. Microdata's tie to the visible text is its one real advantage: when the h1 changes, the name changes with it. Google's structured data guidelines require markup to be a true representation of the page, and attribute-based formats make a mismatch less likely. The cost is that a front-end developer who restructures a component, swaps a span for a div, or moves the price into a separate widget can drop properties without noticing. With JSON-LD, the fix for drift is to generate the block from the same data that renders the page, in the same request.

Injection is not free. Google can read JSON-LD added by JavaScript, including through a tag manager, but crawlers that read only the server's HTML never see it. Do AI crawlers run JavaScript? covers the evidence, and schema markup with Google Tag Manager covers when injection is acceptable. Microdata and RDFa rendered on the server are already in the raw HTML, which is a point in their favour on sites that cannot change how JSON-LD is output.

What happens when two formats describe the same thing

This is common on sites that grew over time: a theme prints Microdata on the product template, and an SEO plugin or a later developer adds a JSON-LD Product block. What the specifications and Google say, and what they leave open:

  • JSON-LD with JSON-LD. The JSON-LD 1.1 specification says that when JSON-LD is extracted as RDF, and unless a specific script is targeted, all application/ld+json script elements "MUST be processed and merged into a single dataset". It also says that defining how such data may be used is beyond its scope, and merging does not settle conflicting values. Common JSON-LD errors covers conflicting blocks from plugins and themes.
  • JSON-LD with Microdata or RDFa. Neither specification defines how a consumer combines items across formats. Google documents that it understands multiple items on a page, but not whether it merges a JSON-LD Product with a Microdata Product, even when @id and itemid carry the same URL.
  • Conflicting values. If the Microdata price comes from the visible text and the JSON-LD price comes from a cached feed, the page now gives two answers. No public documentation says which one Google or Bing uses.

So the safe rule is one entity, one format. If you want separate blocks for different entities, such as Organization in JSON-LD and BreadcrumbList in Microdata from a theme, that is less risky, but you then lose the easy @id references that tie a page's entities into one graph. Connecting entities with @id in JSON-LD shows that pattern.

How to check which formats a page uses

Start with the raw HTML, which is what a crawler that does not run JavaScript receives. This counts the markers for each format:

bash
curl -s https://example.com/products/oak-table -o page.html
printf 'JSON-LD blocks: '; grep -oi 'application/ld+json' page.html | wc -l
printf 'Microdata items: '; grep -oi 'itemscope' page.html | wc -l
printf 'RDFa typeof: '; grep -oi ' typeof=' page.html | wc -l
grep -oi 'itemtype="[^"]*"\|typeof="[^"]*"\|"@type": *"[^"]*"' page.html | sort | uniq -c

A product page that prints Product under both itemtype and "@type" has the duplication described above. Then test the live URL in Google's Rich Results Test, which renders the page and shows the rich result types Google detects (not every schema.org type), and in the Schema Markup Validator for schema.org validity across all types. If markup is valid but the rich result still does not appear, see rich results not showing with valid markup.

How to migrate from Microdata or RDFa to JSON-LD

  1. Inventory. Run the check above on one page per template and list every type and property you output today, with where each value comes from.
  2. Build the JSON-LD from data. Serialize an object from the same fields the template renders, with a JSON encoder rather than string concatenation.
  3. Match every value. Compare the new block with the old markup and with the visible page: name, price, currency, availability, dates and image URLs.
  4. Remove the old attributes in the same release. Strip itemscope, itemtype, itemprop, or vocab, typeof, property, from the template. The visible page should not change; hidden meta and link elements that existed only for markup can go.
  5. Verify. Re-run the curl check (one format per entity), test a few URLs per template in the Rich Results Test, then watch the rich result reports in Search Console after Google recrawls.

Doing steps 2 and 4 in separate releases leaves a window with duplicate items, which is the situation the previous section warns about.

Frequently asked questions

Does Google rank JSON-LD higher than Microdata?

Google says all three formats are equally fine when the markup is valid and properly implemented. It recommends JSON-LD because it is easier to implement and maintain, not because it scores better.

Should I convert working Microdata to JSON-LD?

Not urgently. If the Microdata is valid and matches the page, it works; convert when you next rebuild the templates, or sooner if duplicate JSON-LD from a plugin is already describing the same entities.

Can I use JSON-LD and Microdata on the same page?

Yes, for different entities. Avoid describing the same entity in both, because no specification or Google page says how the two would be reconciled if their values differ.

Is RDFa still supported?

Google lists RDFa as a supported format at the time of writing, and Bing named it among the formats its Markup Validator supported in 2018. The schema.org site still shows most of its examples in RDFa as well as Microdata and JSON-LD.

Do AI search tools prefer one format?

OpenAI, Anthropic and Perplexity do not mention structured data in their crawler documentation at the time of writing, so none documents a preferred format. Whatever format you use, keep the same facts in the visible text.

Next step

Check one page per template and confirm each entity is described once, in the raw HTML. The free check shows what a crawler receives from a single page, including its structured data, with no account needed.

Filed under Structure and schema. Topics: structured-data, json-ld, html, google, bingbot