Structured Data: JSON-LD or Microdata? Which Should I Use?

Recipe Microdata and JSON-LD are two different ways to mark up your data using the schema.org vocabulary. It’s best to choose either microdata or JSON-LD and avoid using both types on a single page or email.

Microdata

Microdata uses HTML tags and attributes to define data. For example, here’s some HTML that describes an event:

<div> 
  Come hear the Tiny Tim Tribute Band, live in concert on 
  July 6, 2013 at the beautiful Regency Theater!
</div>

And here’s the same HTML with microdata markup:

<div  > 
  Come hear the 
  <span >Tiny Tim Tribute Band</span>, 
  live in concert on 
  <span  
  content="2013-07-06>July 6, 2013</span> 
  at the beautiful
  <span   
    > 
    <span >Regency Theater</span>!
  </span>
</div>

See About microdata for more information.

JSON-LD

JSON-LD uses a JavaScript object in your HTML page to define data. For example, here’s JSON-LD that describes an event:

<script type="application/ld+json">
{
  "@context" : "https://schema.org",
  "@type" : "Event",
  "name" : "Slim Whitman Tribute",
  "startDate" : "2013-07-06",
  "location" : {
    "@type" : "Place",
    "name" : "Hollywood Bowl"
  }
}
</script>

See JSON-LD for more information.

(2020 update) Hint: Google now prefers JSON for web content!

New to Structured Data? How do I get this awesome thing on my site?: Try Markup Helper

Markup Helper can show you how to add schema.org markup to pages on your site describing products that are available for sale. If you mark up these pages, Google may make the information available as rich snippets on search result pages or in other Google properties. Information such as a product’s name, price, and review ratings can help users decide which pages to click on in search results.

While you’re tagging a page, Markup Helper will show you all of the required information and much of the optional information that you can tag for a product. The schema.org reference documentation for the Product schema lists all properties that you can tag, including properties that Markup Helper doesn’t support.

~Google.com

When you’re done, you can use Google’s Structured Data Testing Tool and check your work.