Microdata is not dead. While Microdata will not become a W3C standard¹, it’s still part of WHATWG’s HTML Living Standard.
Differences between JSON-LD, Microdata, and RDFa
(in the context of HTML documents)
Microdata and RDFa are conceptually similar: both syntaxes define attributes that get added to your existing HTML elements.
JSON-LD is a syntax that gets added to a script
element (used as data block, not as script), separately from your existing markup.
So the primary difference between Microdata/RDFa and JSON-LD is that you have to repeat the content if using JSON-LD, while you can² mark up your existing content if using Microdata/RDFa.
These three snippets convey the same structured data (a Person
with a name
of "Alice"):
<!-- Microdata -->
<p itemscope itemtype="http://schema.org/Person">
Hi, I’m <span itemprop="name">Alice</span>.
</p>
<!-- RDFa -->
<p vocab="http://schema.org/" typeof="Person">
Hi, I’m <span property="name">Alice</span>.
</p>
<!-- JSON-LD -->
<p>
Hi, I’m Alice.
</p>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"name": "Alice"
}
</script>
Which to use?
JSON-LD if you want to add a blob of structured data, without having to care about existing markup. Might be easier for tools that don’t support structured data (and you use other tools to generate/add it), or when copy-pasting ready-made snippets.
Microdata/RDFa if you want to make use of your existing markup (so you don’t have to duplicate the content → DRY). Might be easier if adding it by hand, or when tools already support it (like Drupal).
If deciding between Microdata and RDFa: I recommend to use RDFa instead of Microdata, primarily because of the differences outlined in this answer on Stack Overflow.
RDFa and JSON-LD are both W3C Recommendations and both are RDF serializations.
For reference: an older related answer about Microformats vs. Microdata vs. RDFa / Schema.org.
¹ At least not in the foreseeable future. https://www.w3.org/TR/microdata/ became a W3C Working Group Note in 2013 (https://www.w3.org/TR/2013/NOTE-microdata-20131029/), so it no longer gets updated/edited, and it will not become a W3C Recommendation.
² Of course Microdata/RDFa would allow to do something similar to JSON-LD: instead of marking up existing content, you could add meta
/link
elements that repeat the content. Bad practice, but possible.