Which to use: microdata or JSON-LD?

Question: structured data markup 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 problem 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 bit here.

A few important reminders first:

  • Microdata is an extension of HTML for tagging content. Imagine, for practical effect, as something that "mouses over and discovers 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 of each piece of content very well.

… Imagining that a Semantic Web robot, eg. , turns any HTML page into a "catalog sheet" (FICHA) descriptor of the page:

  • Microdata markup can be seamlessly translated into JSON-LD, RDFa, or RDF.
    Imagine that transforming the entire markup into a simple FICHA, it will be the same FICHA, 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.
    That is, there is a complex FORM 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 presenting an artist's review, with the <body> already tagged with Microdata for example from WebPage and copyrightHolder (you) and genre (review) properties; then add to 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's 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 is done "blindly", or based on metadata that is eventually not even present in the HTML content, but the CMS ( content manager system ) has access and can generate automatically — 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 "by hand", there are tools that help, typically "JSON-LD generators", like this or this other . Eg if the page is about a person, describe it with Person with basic public information.

More serious semantic markup

[Prefer Microdata]

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

PS: we can technically reference IDs in JSON-LD, but having the content tagged explicitly 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 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 one ) we guarantee that all metadata required by the LexML standard is exactly the same as what the human reader is auditing when reading the document.

General rule: when in doubt…

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

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

Scroll to Top