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!
- It seems that Bing also prefers this method: https://www.bing.com/webmaster/help/marking-up-your-site-with-structured-data-3a93e731 and supports RDFa (as does google).
- Yahoo supports both as well: https://developer.yahoo.com/blogs/ydn/introducing-schema-org-collaboration-structured-data-44741.html
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