Lesson 9 / 34

Schema.org Structured Data

Use JSON-LD and microdata to markup content and help search engines understand your pages.

By · 15 years in web development · Updated 1 Oct 2026

What is structured data?

Structured data is markup that tells search engines the exact meaning of your content. Instead of just reading "John Doe — 5 stars," Google sees: Person name="John Doe", Rating=5. This enables rich snippets, knowledge panels, and better ranking.

JSON-LD example: Article

JSON-LD is the preferred format for structured data. It goes in the <head> and describes the page content clearly.

<head>
  <script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "Mastering HTTP Status Codes",
    "description": "A developer's guide to understanding HTTP status codes and when to use them.",
    "image": "https://example.com/http-codes.jpg",
    "datePublished": "2025-10-01",
    "dateModified": "2025-10-15",
    "author": {
      "@type": "Person",
      "name": "Jane Developer",
      "url": "https://example.com/author/jane"
    },
    "publisher": {
      "@type": "Organization",
      "name": "Tech Blog",
      "logo": {
        "@type": "ImageObject",
        "url": "https://example.com/logo.png"
      }
    },
    "mainEntityOfPage": {
      "@type": "WebPage",
      "@id": "https://example.com/http-codes"
    }
  }
  </script>
</head>

JSON-LD example: Product

For e-commerce sites, markup products with ratings, prices, and availability. This enables Google Shopping integration and rich snippets.

<head>
  <script type="application/ld+json">
  {
    "@context": "https://schema.org/",
    "@type": "Product",
    "name": "Mechanical Keyboard RGB",
    "image": "https://example.com/keyboard.jpg",
    "description": "Premium mechanical keyboard with RGB lighting",
    "brand": {
      "@type": "Brand",
      "name": "KeyMaster"
    },
    "offers": {
      "@type": "Offer",
      "url": "https://example.com/products/keyboard",
      "priceCurrency": "USD",
      "price": "129.99",
      "availability": "https://schema.org/InStock"
    },
    "aggregateRating": {
      "@type": "AggregateRating",
      "ratingValue": "4.5",
      "bestRating": "5",
      "worstRating": "1",
      "ratingCount": "248"
    }
  }
  </script>
</head>

Validate your markup

Always validate structured data with the Schema.org validator or Google's Rich Results Test. Invalid markup is ignored; valid markup gets you rich snippets.