Skip to content
hostcomplex

JSON-LD vs Microdata

Maarten Soetens 3 min read

Three Ways to Write the Same Structured Data

JSON-LD vs Microdata is a comparison of two syntaxes for writing structured data, with RDFa as a third option. All three can describe the same schema.org types and properties. They differ in where the information sits in the HTML, which affects how easily it is maintained.

JSON-LD is usually the simplest choice because it keeps the data apart from the page layout. The other two are still read by search engines, but they need more care when a page is redesigned. The enhanced listings this data can unlock are described in the rich results article.

How Each Format Is Written

JSON-LD, which stands for JavaScript Object Notation for Linked Data, places the data in a single script block, separate from the visible HTML. The block is a set of key and value pairs, such as "@type": "Organization", which declares what kind of item is described.

Microdata adds attributes such as itemscope, itemtype and itemprop to existing HTML elements. The markup is spread through the page, next to the content it describes.

RDFa, short for Resource Description Framework in Attributes, uses a similar approach with attributes such as typeof and property. It is flexible enough to describe vocabularies beyond schema.org, and it is common in some publishing platforms.

One Organization, Three Syntaxes

A company called Example Ltd, with its website at example.com, could state its name in each syntax. In JSON-LD it is one property inside the script block: "name": "Example Ltd". In Microdata it is an attribute on the element that displays the name: <span itemprop="name">Example Ltd</span>. In RDFa it is written the same way with a property attribute.

All three express the same fact. The difference is whether the fact lives in a separate block or is woven into the page’s markup.

Why JSON-LD Is Usually Easier to Maintain

Because JSON-LD sits in its own block, it can be changed without touching the page layout. A developer can update a product’s price in the data when the template changes, and a designer can redesign the page without changing the data block.

Microdata and RDFa are tied to specific HTML elements. A redesign that moves or renames those elements can break the markup without anyone noticing. A script that adds JSON-LD after the page loads raises a different question, which is whether search engines can render the page, not how the markup is formatted.

Frequently asked questions

Which structured data format should I use?

For most websites, JSON-LD is the best choice. Major search engines recommend it, it keeps the markup separate from the page design, and it is easier to check. Microdata or RDFa usually make sense when a platform already generates them or existing code depends on them.

Do search engines read all three formats equally?

Major search engines support JSON-LD, Microdata and RDFa, but the documentation for each enhanced feature lists the formats and types it accepts. Some features may only be documented for one format, so check that documentation before choosing a syntax for a specific feature.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.