Structured Data · Basics Article 2

Three Formats Compared: JSON-LD vs Microdata vs RDFa

~12 min read Updated 2026-06-23 MagicSEO Editors · Human Reviewed Structured Data

In the previous article we covered the concept and value of structured data. Before adding it, you need to make a decision: which format? There are three markup formats for structured data—JSON-LD, Microdata, and RDFa. They all convey the same semantic information, but differ significantly in how they're written, maintenance cost, and Google's recommendation. The conclusion first: choose JSON-LD.

Overview of the Three Formats#

JSON-LD

JSON-LD (JavaScript Object Notation for Linked Data) is structured data written in JSON syntax, placed inside a <script type="application/ld+json"> tag. It's completely separate from HTML—your structured data is an independent JSON object that requires modifying no existing HTML tags.

This is the officially Google-recommended format and currently the most widely used.

Microdata

Microdata annotates semantics by adding itemscope, itemtype, and itemprop attributes to HTML tags. It's embedded directly in the existing HTML structure, corresponding one-to-one with page elements.

Microdata appeared earlier, and many older sites and early CMS themes still use it. Google fully supports it but no longer recommends it first.

RDFa

RDFa (Resource Description Framework in Attributes) is similar to Microdata—embedding semantic annotations through HTML attributes, using vocab, typeof, property, and other attributes. Its syntax is slightly more complex than Microdata and it's mostly used in scenarios integrating with the Semantic Web ecosystem.

It has the lowest usage rate in SEO practice; Google supports it but rarely uses it as a primary example in documentation.

Format Comparison#

DimensionJSON-LDMicrodataRDFa
Placement<script> tag (head or body)Embedded in HTML tag attributesEmbedded in HTML tag attributes
Coupling with HTMLFully decoupledHighly coupledHighly coupled
ReadabilityClear JSON structureScattered across multiple tagsScattered across multiple tags
Maintenance difficultyLow (modify independently)High (changing HTML affects markup)High (changing HTML affects markup)
CMS compatibilityExcellent (independent injection)Requires template changesRequires template changes
Multiple schemas coexistingMultiple script tags side by sideRequires nesting or splitting HTMLRequires nesting or splitting HTML
Dynamic generationJust generate JSON with JSRequires DOM attribute manipulationRequires DOM attribute manipulation
Google recommendation✅ First choice✅ Supported✅ Supported

Why Google Prefers JSON-LD#

Google states clearly in its official structured data documentation: "Google recommends using JSON-LD for structured data whenever possible." The reasons:

  • Decoupled from HTML: JSON-LD sits in an independent <script> tag and requires modifying no HTML elements. When the page design is reworked, the structured data is unaffected—and vice versa.
  • Easy to read and debug: One complete JSON object with all properties in one place is easier to inspect and modify than attributes scattered across a dozen HTML tags.
  • CMS- and template-friendly: You can inject a script tag into the template's head or body without modifying the HTML structure of the article content area.
  • Supports dynamic generation: JavaScript can create or modify the JSON-LD object at runtime. Google's rendering engine can read JSON-LD inserted dynamically by JavaScript.
  • Easy coexistence of multiple types: Need Article + BreadcrumbList + FAQPage on the same page? Just add three <script type="application/ld+json"> tags, each independent.

The Same Data, Three Ways#

Below, using a simple Article markup as an example, we show how the same semantic information looks in each of the three formats.

JSON-LD Version

JSON-LD
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Do Keyword Research Well",
  "author": {
    "@type": "Person",
    "name": "John Doe"
  },
  "datePublished": "2026-06-20",
  "image": "https://example.com/keyword-research.jpg"
}
</script>

The entire markup is concentrated in one JSON object, completely independent of the page HTML.

Microdata Version

Microdata
<article itemscope itemtype="https://schema.org/Article">
  <h1 itemprop="headline">How to Do Keyword Research Well</h1>
  <img itemprop="image"
       src="https://example.com/keyword-research.jpg"
       alt="Keyword Research">
  <span itemprop="author" itemscope
        itemtype="https://schema.org/Person">
    <span itemprop="name">John Doe</span>
  </span>
  <time itemprop="datePublished"
        datetime="2026-06-20">2026-06-20</time>
</article>

The semantic attributes are scattered across the various HTML tags. If you change the HTML structure (for example, changing <h1> to <h2>, or moving elements), you need to check at the same time whether itemprop is still correct.

RDFa Version

RDFa
<article vocab="https://schema.org/" typeof="Article">
  <h1 property="headline">How to Do Keyword Research Well</h1>
  <img property="image"
       src="https://example.com/keyword-research.jpg"
       alt="Keyword Research">
  <span property="author" typeof="Person">
    <span property="name">John Doe</span>
  </span>
  <time property="datePublished"
        datetime="2026-06-20">2026-06-20</time>
</article>

RDFa's structure is very similar to Microdata; the difference is the attribute names (property replaces itemprop, typeof replaces itemtype). It's equally highly coupled with HTML.

At a GlanceJSON-LD's entire markup is concentrated in one <script> tag, while Microdata and RDFa markup is scattered across every HTML element. When the page structure is complex and there are many markup types (Article + BreadcrumbList + FAQPage), JSON-LD's maintenance advantage becomes even more obvious.

JSON-LD Advantages in Detail#

Fully Decoupled from HTML

This is JSON-LD's biggest advantage. Structured data and page presentation are each independent:

  • Front-end developers reworking the design don't need to worry about breaking structured data
  • The SEO team modifying structured data doesn't need to touch front-end code
  • When A/B testing page layouts, the structured data stays unchanged

CMS- and Automation-Friendly

JSON-LD can be auto-generated by template systems, plugins, or backend logic and injected into the page's <head>, without modifying the HTML structure of the article body. Mainstream SEO plugins like Yoast and Rank Math for WordPress default to outputting JSON-LD.

Multiple Schemas Coexisting Without Conflict

The same page can have multiple independent <script type="application/ld+json"> tags, each describing a different type of data. They don't interfere with each other and don't need nesting relationships handled at the HTML level.

Multiple schemas coexisting
<!-- Schema 1: Article -->
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "Article", ... }
</script>

<!-- Schema 2: BreadcrumbList -->
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "BreadcrumbList", ... }
</script>

<!-- Schema 3: FAQPage -->
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "FAQPage", ... }
</script>
Site ExampleThis article's <head> contains three independent JSON-LD tags: Article (describing the article itself), BreadcrumbList (describing the breadcrumb navigation path), and FAQPage (describing the FAQ at the end of this article). The three don't interfere with each other and each is complete.

When Are Microdata and RDFa Still Useful#

Although JSON-LD is the best choice, the other two formats aren't entirely obsolete:

  • Legacy systems: If your site already uses Microdata extensively and correctly, migration isn't a high priority. Google parses all three formats equally.
  • Specific CMS or platform constraints: Some platforms may not allow injecting custom <script> tags but do allow modifying HTML attributes—in this case Microdata is the only choice.
  • Email HTML: Google supports marking up events, orders, and other information in Gmail emails with Microdata/JSON-LD. Some email clients have security restrictions on script tags, where Microdata may be more reliable.
  • Non-Google consumers: Some Semantic Web tools and knowledge-graph systems have special support for RDFa. But if your target is Google search, this isn't a consideration.

Recommendation#

ScenarioRecommended FormatReason
New projectJSON-LDGoogle-recommended, easy to maintain, decoupled from HTML
Existing correct MicrodataKeep MicrodataMigration cost exceeds benefit, Google supports equally
Planning to add lots of markupJSON-LDUse JSON-LD for new markup, gradually migrate old markup
Can't inject script tagsMicrodataEmbedding in HTML attributes is the only option

Subsequent articles in this section all use JSON-LD as the example format. The next article explains in detail how to add JSON-LD to a page, including placement, basic structure, and complete hands-on steps.

Frequently Asked Questions#

Can JSON-LD, Microdata, and RDFa be mixed on the same page?

Technically yes, and Google can parse structured data in different formats on the same page. But it's strongly recommended not to mix them—mixing increases maintenance complexity and makes conflicts or omissions more likely. Choosing one format, JSON-LD, and using it consistently is the best practice.

Does an old site already marked up with Microdata need to migrate to JSON-LD?

If your existing Microdata markup is correct and the maintenance cost is manageable, there's no need to rush migration—Google still fully supports Microdata. But if you plan to add more structured data types, or the existing markup is hard to maintain, migrating to JSON-LD is the better long-term choice. You can replace it page by page during migration; it doesn't need to be done all at once.

Why do some CMS or plugins generate Microdata instead of JSON-LD?

Historical reasons. Microdata appeared earlier than JSON-LD, and many early WordPress themes and SEO plugins defaulted to Microdata (embedding directly in HTML tag attributes). Now mainstream SEO plugins (like Yoast, Rank Math) default to generating JSON-LD. If your theme still outputs Microdata, you can switch in the plugin settings or manually add JSON-LD to override it.