What is JSON-LD? The Beginner-to-Expert Guide

Last Updated: February 25, 2026 ยท 12 min read

JSON-LD stands for JavaScript Object Notation for Linked Data. It is a lightweight format for adding structured data to web pages โ€” metadata that search engines, browsers, and AI systems read to understand what your content is actually about. If you have ever seen star ratings, recipe cards, or FAQ dropdowns in Google search results, they were powered by JSON-LD.

๐Ÿ’ก The 30-second explanation

Your HTML tells browsers how to display your content. JSON-LD tells search engines what your content means. A price tag in HTML is just text. Wrapped in JSON-LD Product schema, it becomes structured data that Google can display as a rich result.

1. How JSON-LD Actually Works

JSON-LD is added to a page inside a special <script> tag with the type application/ld+json. It does not change anything visible to users. It is purely for machines.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "What is JSON-LD?",
  "datePublished": "2026-02-25",
  "author": {
    "@type": "Person",
    "name": "Jane Doe"
  }
}
</script>

The three key pieces:

  • @contextAlways https://schema.org โ€” the shared vocabulary that defines what every type and property means.
  • @typeWhat kind of thing this is: Article, Product, LocalBusiness, Recipe, etc.
  • PropertiesKey-value pairs like headline, datePublished, price โ€” all defined by Schema.org.

2. JSON-LD vs Microdata vs RDFa

There are three ways to add structured data to HTML. Google supports all three but officially recommends JSON-LD.

FormatWhere it livesEase of useGoogle recommendation
JSON-LDSeparate <script> tagโญโญโญ Easiestโœ… Recommended
MicrodataMixed into HTML attributesโญโญ ModerateSupported
RDFaMixed into HTML attributesโญ ComplexSupported

JSON-LD wins because: (1) it is completely separate from your HTML so it cannot break your layout, (2) it is easy to update without touching the DOM, (3) JavaScript frameworks can inject it dynamically, and (4) it is the easiest to validate and debug.

3. Which Schema Types Get Rich Results?

RecipeRecipe card with image, cooking time, ratings
ProductPrice, availability, star ratings in SERP
FAQPageExpandable FAQ directly in search results
HowToStep-by-step carousel on mobile
EventEvent listing with date, location, ticket price
JobPostingJob listing in Google Jobs
ArticleTop Stories eligibility, author display
LocalBusinessKnowledge Panel, Maps integration

4. How to Add JSON-LD to Any Website

Plain HTML

Paste inside <head> or just before </body>:

<head>
  <script type="application/ld+json">
  {
    "@context": "https://schema.org",
    "@type": "WebSite",
    "name": "My Website",
    "url": "https://example.com"
  }
  </script>
</head>

Next.js / React

// In your page component or layout.tsx
const jsonLd = {
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "My Article Title",
  "datePublished": "2026-02-25",
};

return (
  <>
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
    />
    {/* ... rest of page */}
  </>
);

WordPress (without a plugin)

Add to your theme's functions.php:

function add_json_ld() {
  if (is_singular('post')) {
    echo '<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "BlogPosting",
      "headline": "' . get_the_title() . '",
      "datePublished": "' . get_the_date('c') . '"
    }
    </script>';
  }
}
add_action('wp_head', 'add_json_ld');

5. The 5 Most Common JSON-LD Mistakes

1

Missing @context

Always include "@context": "https://schema.org" โ€” without it, search engines cannot resolve the vocabulary.

2

Invalid JSON syntax

A single missing comma or unclosed brace breaks the entire block. Validate at schemavalidator.org before deploying.

3

Content mismatch

The structured data must reflect actual visible page content. Do not mark up content that is not on the page โ€” Google will penalise this.

4

Wrong property names

Schema.org property names are case-sensitive. "datePublished" works; "DatePublished" does not.

5

Missing required properties

Most schema types have required properties for rich results. Check Google's documentation for the specific type you are implementing.

Frequently Asked Questions

Does JSON-LD guarantee rich results in Google? โ–ผ

No. Valid JSON-LD makes you eligible for rich results, but Google decides whether to display them based on content quality, page authority, query relevance, and whether the schema accurately reflects the page. A zero-error validation report is a necessary condition, not a sufficient one.

Can I add multiple JSON-LD blocks on one page? โ–ผ

Yes โ€” you can have as many script type="application/ld+json" blocks as you need. Each one is parsed independently. This is actually better practice than combining everything into one large block, because it keeps each schema type isolated and easier to maintain. Common pattern: one block for Organization in the layout + one block per page type (Article, Product, etc.).

Does JSON-LD need to be in the head tag? โ–ผ

No. Google can read JSON-LD from anywhere in the document โ€” head or body. Best practice is head so it is available as early as possible during parsing, and so it does not affect visible page rendering. In Next.js, placing it in the server component means it is always in the initial HTML response, which is ideal.

How long does it take for JSON-LD to appear in Google rich results? โ–ผ

Typically 2โ€“4 weeks after Google re-crawls and processes the page. You can speed this up by submitting the URL in Google Search Console under URL Inspection โ†’ Request Indexing. After crawling, the rich result still takes 1โ€“2 weeks to appear in active SERPs as Google processes and validates the structured data.

Is JSON-LD different from Schema.org? โ–ผ

JSON-LD is the format (how you write structured data). Schema.org is the vocabulary (what the properties and types mean). Think of Schema.org as a dictionary and JSON-LD as the language you write it in. You can also express Schema.org using Microdata or RDFa format, but JSON-LD is the recommended choice because it is clean, separate from HTML, and easiest to validate.

Can I use JSON-LD with Next.js App Router? โ–ผ

Yes โ€” add a script tag with type="application/ld+json" and dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }} directly in your page.tsx or layout.tsx server components. Since these are server-rendered, the JSON-LD will be in the initial HTML response, which is exactly what Googlebot needs. Do not use useEffect to inject JSON-LD โ€” that makes it client-side only and invisible to bots that do not execute JavaScript.

What happens if my JSON-LD has a syntax error? โ–ผ

A JSON syntax error (missing comma, unclosed bracket, unescaped quote) causes the entire JSON-LD block to fail silently. Google ignores the malformed block completely โ€” no error in GSC, no rich result, no feedback. This is why validating before deployment is critical. Always run your schema through a validator that checks JSON syntax first, then schema.org property validation.

Can I generate JSON-LD dynamically from my CMS data? โ–ผ

Yes โ€” and this is the recommended approach at scale. In Next.js, fetch your CMS data in the server component and use JSON.stringify() to generate the JSON-LD from real data. In WordPress, use a filter hook to generate schema from post meta. Never hardcode values like price, availability, or rating โ€” these change and stale schema causes rich result removal.

Validate Your JSON-LD Instantly

Paste your JSON-LD and get errors, warnings, and rich-result eligibility in seconds.

Open Free Validator โ†’