Skip to content

Implement JSON-LD

Reference

JSON-LD (JavaScript Object Notation for Linked Data) is the recommended way to add schema.org structured data to most pages. The structured data sits in a script block and is kept separate from the visible markup, which makes it easy to add, audit, and maintain.

Objective

Add valid schema.org JSON-LD to a page so that search engines can understand the entity the page describes.

Steps

  1. Identify the primary entity of the page. A product page describes a Product. An article describes an Article. A local business page describes a LocalBusiness or a more specific subtype.

  2. Choose the most specific type. Prefer Restaurant over LocalBusiness when the page is about a restaurant. Prefer Movie over CreativeWork for a film.

  3. Create a script block. Place a script element with the type application/ld+json in the head or body of the page.

html
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Executive Anvil",
  "image": "https://example.com/anvil.jpg",
  "description": "Sleeker than ACME's Classic Anvil.",
  "sku": "0446310786",
  "brand": {
    "@type": "Brand",
    "name": "ACME"
  },
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/anvil",
    "priceCurrency": "USD",
    "price": "119.99",
    "availability": "https://schema.org/InStock"
  }
}
</script>
  1. Add the context. The @context value of https://schema.org tells parsers that property names map to the schema.org vocabulary.

  2. Add the type. The @type value names the type. Nested objects each get their own @type.

  3. Add required and recommended properties. Use the property names exactly as defined in the vocabulary. Values can be text, numbers, URLs, dates in ISO 8601 format, or nested objects.

  4. Reference enumerations by URL. Properties such as availability expect an enumeration member, written as a full vocabulary identifier such as https://schema.org/InStock.

  5. Validate. Test the output, fix any errors, and publish.

Done when

  • The JSON-LD parses as valid JSON.
  • The validator reports no errors for the chosen type.
  • The visible content on the page matches the structured data.

Common pitfalls

  • Structured data that does not match the visible page content can be treated as spam.
  • Dates must use ISO 8601, for example 2026-06-10.
  • Currency values are strings, not numbers, to preserve formatting.