Skip to content
All articles

JSON-LD vs Microdata vs RDFa: which structured data format to use?

guide // , 5 min read, by Darthwares

For most websites, you should use JSON-LD as your structured data format. Google recommends JSON-LD because it is the easiest solution for website owners to implement and maintain at scale, making it less prone to user errors. Structured data is a standardized format for providing information about a page and classifying its content, such as listing ingredients, cooking times, or calories on a recipe page. Major search engines support the Schema.org vocabulary across JSON-LD, Microdata, and RDFa formats.

A simple diagram comparing JSON-LD script tags, Microdata inline attributes, and RDFa tag extensions on a web page.
On this page // 6 sections
  1. 01What is JSON-LD and how does it work?
  2. 02What is Microdata and how does it work?
  3. 03What is RDFa and how does it work?
  4. 04Which format does Google recommend and why?
  5. 05How do you diagnose and fix structured data errors?
  6. 06Common questions

The short version

  • Google recommends JSON-LD because it is easiest to implement and maintain at scale.
  • Microdata nests metadata directly within existing HTML content using tag attributes.
  • RDFa extends HTML5 and XHTML with attributes that provide machine-readable hints.
  • All three formats are equally valid for search engines if correctly implemented.

What is JSON-LD and how does it work?

JSON-LD is a lightweight syntax that serializes linked data inside a script tag on your web page. Google documents that JSON-LD is embedded in a script tag within the head or body elements of an HTML page. The W3C specifies that JSON-LD is a lightweight syntax to serialize Linked Data using JSON. Its design allows existing JSON to be interpreted as Linked Data with minimal changes.

Because JSON-LD is compatible with JSON, the large number of JSON parsers and libraries available today can be reused. It is designed to be usable directly as JSON without requiring prior knowledge of RDF standards. JSON-LD is primarily intended for web programming environments, building interoperable web services, and JSON-based storage engines.

What is Microdata and how does it work?

Microdata is an HTML specification that nests machine-readable metadata directly inside existing page content using HTML tags and attributes. MDN Web Docs notes that Microdata is part of the WHATWG HTML Standard and provides a declarative way to annotate HTML elements. Schema.org explains that Microdata was introduced with HTML5 to allow developers to add structured information directly to HTML tags. It relies on a supporting vocabulary to describe items using name-value pairs for properties.

Microdata uses specific attributes to define data structure within your page markup. The itemscope attribute creates an item and defines its scope, while the itemtype attribute specifies the type of item immediately after itemscope. To label individual properties on descendant elements, you add the itemprop attribute to those elements.

As a general rule from Schema.org, you should mark up only content visible to human visitors on the page, avoiding hidden elements. Information that cannot be marked up directly within visible HTML should use meta tags with content attributes as an exception.

What is RDFa and how does it work?

RDFa is an HTML extension that adds attributes to user-visible elements to attach machine-readable hints to your page markup. RDFa, short for Resource Description Framework in Attributes, is specified by W3C for both XHTML and HTML5. Google describes RDFa as an HTML5 extension supporting linked data by introducing tag attributes that correspond to visible page content. W3C documents state that none of the RDFa-specific attributes affect the visual display of HTML content.

To organize data cleanly, RDFa introduces the vocab attribute to declare a single schema vocabulary for a block of HTML. In the absence of a resource attribute, using the typeof attribute on an enclosing div implicitly sets the subject of the properties marked up within that div element.

Which format does Google recommend and why?

Google recommends JSON-LD for structured data because it is the easiest solution for website owners to implement and maintain at scale, making it less prone to user errors. All three formats are equally fine for Google as long as the markup is valid and properly implemented according to feature documentation. You use the Schema.org vocabulary alongside JSON-LD, Microdata, or RDFa to classify page content like ingredients or calories on a recipe page.

Search engines and web crawlers extract structured data using shared vocabularies like Schema.org to provide a richer browsing experience for users. You can validate your implementation using Google's Rich Results Test tool, which allows you to verify syntax correctness and preview features in Google Search.

How do you diagnose and fix structured data errors?

To diagnose and fix structured data errors, inspect attribute placement in your HTML code, verify that marked-up content is visible to users, and test pages with validation tools.

Errors often occur when Microdata attributes are incorrectly nested or applied to hidden page elements. You can identify missing property labels or invalid item types by testing your pages directly against search engine validation requirements.

  1. 01Inspect your HTML markup to confirm that itemprop attributes are placed on descendant tags inside an itemscope block.
  2. 02Check that marked-up text is visible to page visitors rather than placed inside hidden div elements or hidden containers.
  3. 03Run your page URL or code snippet through the Rich Results Test tool to validate syntax and fix reported errors.
Troubleshooting common structured data issues
SymptomCheckFix
Validation error for missing item typeInspect HTML for itemscope attributes missing an accompanying itemtype URL.Add the correct itemtype attribute immediately after the itemscope attribute.
Properties fail to parse in MicrodataVerify that itemprop attributes are placed on descendant tags inside an itemscope block.Ensure itemprop attributes are positioned inside the element wrapped by itemscope.
Markup ignored due to hidden contentCheck if marked-up text is placed inside hidden div elements or hidden blocks.Move markup to visible HTML content or use meta tags only for non-renderable data.

Common questions

Are all three structured data formats accepted by Google?

Yes, all three formats are equally fine for Google, as long as the markup is valid and properly implemented per the feature documentation.

Can I use JSON-LD without knowing RDF?

Yes, JSON-LD is designed to be usable directly as JSON, with no knowledge of RDF.

Do RDFa attributes change how my web page looks to users?

No, none of the RDFa-specific attributes have any effect on the visual display of the HTML content.

Is it acceptable to mark up hidden HTML content with Microdata?

As a general rule, you should mark up only content visible to people who visit the web page and not content in hidden div elements.

Primary sources and further reading

This article was researched and written by an AI model and published automatically. It was written from sentences that were checked to appear on the pages below, but a person has not reviewed the text. If something is wrong, tell us at chibivikramathithan@darthwares.com and we will correct it.