We use cookies to keep this site working and, with your permission, to remember your preferences, understand site traffic and support advertising. You can change your choice at any time. Cookie Policy

SEO Tool Orbit
Technical SEO

JSON-LD vs Microdata vs RDFa: Which Structured Data Format Should You Use?

All three formats express the same Schema.org vocabulary in different ways. Here's how they differ in practice, with examples, and why JSON-LD is the usual choice.

By SEO Tool Orbit5 min read

Illustration of three code panels side by side, each marked with a different bracket style
Same vocabulary, three ways to write it. · Original illustration by SEO Tool Orbit

Structured data describes what a page contains in a vocabulary machines understand — usually Schema.org. There are three ways to put that description on a page: JSON-LD, Microdata and RDFa. They can express the same facts, and search engines that support structured data read all three. The differences are about how they're written and maintained.

In short: JSON-LD is a separate block of JSON in a script tag; Microdata and RDFa are attributes woven into your HTML. Google recommends JSON-LD because it's easier to write, generate and maintain without touching the visible markup. Use Microdata or RDFa when your platform already produces it reliably, and don't mix formats for the same entity. Whichever you use, valid markup makes a page eligible for rich results — it doesn't guarantee them.

What structured data formats do

Each format answers the same questions: what kind of thing is this (a type such as Article or Product), and what are its properties (headline, author, price). Search engines use that to understand pages and, where eligible, to show enhanced results. The vocabulary is the same in every format; only the syntax changes. Our schema markup guide covers which types are worth using.

The same article in each format

JSON-LD

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Create an XML Sitemap",
  "datePublished": "2026-09-18",
  "author": { "@type": "Person", "name": "Jane Doe" }
}
</script>

Microdata

<article itemscope itemtype="https://schema.org/Article">
  <h1 itemprop="headline">How to Create an XML Sitemap</h1>
  <time itemprop="datePublished" datetime="2026-09-18">18 September 2026</time>
  <p itemprop="author" itemscope itemtype="https://schema.org/Person">
    By <span itemprop="name">Jane Doe</span>
  </p>
</article>

RDFa

<article vocab="https://schema.org/" typeof="Article">
  <h1 property="headline">How to Create an XML Sitemap</h1>
  <time property="datePublished" datetime="2026-09-18">18 September 2026</time>
  <p property="author" typeof="Person">
    By <span property="name">Jane Doe</span>
  </p>
</article>

The names and dates here are placeholders. In your own markup, every value must match what the page actually shows.

Differences in implementation

JSON-LDMicrodataRDFa
Where it livesSeparate script blockAttributes on visible HTMLAttributes on visible HTML
Key syntax@context, @type, propertiesitemscope, itemtype, itempropvocab, typeof, property
Coupled to page designNoYesYes
Easy to generate from dataYesHarderHarder
Risk when redesigningLowHigh — markup moves with the HTMLHigh
Can describe things not shown as HTML elementsYes (but must reflect visible content)Awkward (needs meta tags)Awkward

Nested entities

Real pages describe several connected things: an article with an author and a publisher, a product with offers and reviews. In JSON-LD you nest objects or connect them with @id:

{
  "@context": "https://schema.org",
  "@graph": [
    { "@type": "Organization", "@id": "https://example.com/#org", "name": "Example Co" },
    { "@type": "Article", "headline": "How to Create an XML Sitemap",
      "publisher": { "@id": "https://example.com/#org" } }
  ]
}

In Microdata and RDFa, nesting follows the HTML: a property's value is an element with its own itemscope or typeof. That works, but it means your data structure must mirror your page layout — which is exactly what makes those formats harder to maintain.

Validation methods

  • Schema Markup Validator (validator.schema.org) checks syntax and vocabulary for all three formats.
  • Google's Rich Results Test checks whether markup qualifies for Google's search features — our Rich Results Test does the same job.
  • Search Console reports structured data errors across indexed pages.

How to validate structured data and fix schema errors walks through a full workflow.

Maintenance and CMS considerations

  • Templates and plugins often add markup automatically — check what yours outputs before adding more, to avoid duplicates.
  • Generated JSON-LD built from the same data as the page stays accurate when content changes.
  • Microdata in themes can silently break when a designer changes the HTML structure.
  • Mixed formats describing the same entity twice can confuse parsers. Pick one per entity.

How JSON-LD gets onto the page

  • CMS plugins and themes generate it for common types, such as articles, products and organisations. Check their output before adding your own.
  • Server templates can build it from the same data as the page, which keeps both in sync.
  • JavaScript or tag managers can inject it after the page loads. Google can read JSON-LD added this way, but markup in the server-rendered HTML is more dependable and easier to test.

Migrating from Microdata to JSON-LD

  1. Validate the existing Microdata and record what it describes.
  2. Generate equivalent JSON-LD from the same data, entity by entity.
  3. Add the JSON-LD and remove the Microdata for that entity in the same release, so nothing is described twice.
  4. Validate the live page and watch Search Console's enhancement reports.

Common markup errors

  • Invalid JSON: trailing commas, unescaped quotes, smart quotes pasted from a word processor.
  • Misspelled types or properties ("@type": "article" — types are case-sensitive).
  • Relative URLs where absolute ones are expected.
  • Dates in the wrong format; use ISO 8601 such as 2026-09-18.
  • Markup describing content that isn't on the page.

When to choose JSON-LD

Choose JSON-LD for new implementations, for anything generated from a database or CMS, for markup you'll change often, and whenever several people edit templates. Keep existing Microdata or RDFa if it's accurate and maintained, and migrate when you next rebuild the templates. The AI Schema Generator produces JSON-LD from a page or form and explains each property; for question-and-answer content, the FAQ Schema Generator creates FAQPage markup. Structured data checks also belong in your technical SEO audit.

Frequently asked questions

Does the format affect rankings?

No. Search engines read all three. The format affects how easy your markup is to keep correct.

Can I use more than one format on a page?

You can, for different entities, but don't describe the same entity in two formats. It invites duplicates and conflicts.

Will valid structured data give me rich results?

No guarantee. Valid markup makes a page eligible; search engines decide whether to show a rich result. Some features are also limited to certain kinds of site — see our AEO guide on FAQ results.

Is JSON-LD read if it's in the body instead of the head?

Yes. JSON-LD can be placed in the head or the body; search engines read it either way.

Next step

Check which format your site uses today by viewing the source of a key page. If it's Microdata inside a theme, plan a move to generated JSON-LD at your next template update, starting with the AI Schema Generator.

Illustration of a tree of connected structured-data nodes

Technical SEO

Schema Markup for AI Search and Modern SEO

Structured data helps search engines understand your pages. Learn the fundamentals, the types worth adding, how to validate them and what schema can't do.

6 min read