Which one to use: microdata or JSON-LD?

Question: structured data tagging for Google, Yahoo!, Bing, and Yandex search engines is great for rich snippets . However I noticed that most webmasters use microdata and almost never use JSON-LD . I recently got to know JSON-LD and I have some questions that I didn't find by searching:

  1. Can I use it without compatibility issue with all search engines?
  2. Can I use the src="" attribute?


I answered something similar in 2017 , but I'll try to refine it a little here.

First some important reminders:

  • Microdata is an HTML extension for tagging content. Imagine, for practical effect, as something that "mouse over and discover the semantics of the fragment".

  • JSON-LD will generally be used for the "catalog sheet" in this type of HTML application, unless you tie the identifiers to each piece of content very tightly.

… Imagine that a Semantic Web robot, like eg. transforms any HTML page into a "catalographic sheet" descriptor of the page:

  • Microdata markup can be perfectly translated into JSON-LD, RDFa or RDF.
    Imagine that transforming the entire markup into a simple FILE, it will be the same FILE, regardless of the language.
    PS: The formal definition of Microdata was created along with this translation (see "Converting Microdata to other formats" in the new proposal ).

  • Microdata is less expressive than RDFa or JSON-LD.
    In other words, there is a complex DATA SHEET that can only be expressed with JSON-LD (see "Microdata and RDF" in the new proposal ).

NOTE: There is no technical impediment or dichotomy, you can use JSON-LD and Microdata together on the same page.
Imagine your own HTML showing an artist's review, with the <body> already marked with Microdata for example WebPage and copyrightHolder (you) and genre (review) properties; then add in the <head> or <body> the <script type="application/ld+json"> with the JSON-LD of Person, describing the artist.

Repetitive contextualization headers

[Prefer JSON-LD]

If the site wants to standardize on all its pages, general properties such as permissions, authorship, etc. it is much simpler and more practical to add JSON-LD to all of them. WordPress and hundreds of other tools love to do this, precisely because it's done kind of "blindly", or based on metadata that might not even be present in the HTML content, but the CMS ( content manager system ) has access and can automatically generate — for example. SQL tools such as PostgreSQL generate JSON from relational data.

PS: if you've never had much contact with this and want to generate it "by hand", there are tools that help, typically "JSON-LD generators", like this one or this one . Eg if the page is about a person, describe it with Person with basic public information.

More serious semantic tagging

[Prefer Microdata]

When you really want to highlight the semantics of pictures, text blocks, etc. as if summarizing for the reader what that content is about, the ideal and most used is the direct tagging on the content, that is, Microdata.

PS: technically we can reference IDs in JSON-LD, but having the content explicitly tagged is still considered more reliable than referencing IDs. Tools like dbpedia-spotlight help markup along the text.


[Prefer Microdata]

For example, in a contract or in an article in the Official Gazette, to mark identification elements, it is essential that what the human reads is also what the machine will interpret. In this case for example (or in this other ) we guarantee that all the metadata required by the LexML standard is exactly the same that the human reader is auditing when reading the document.

General rule: when in doubt…

  • Merely technical doubt about which technology to use, Google and SEO enthusiasts suggest JSON-LD

  • If the question is "what should I describe?" then the best thing is to use Microdata, as the semantics will emerge from your markup made on the content. Expressing yourself with Microdata is simpler and there are good editors.

Scroll to Top