Skip to main content
Beta: Front-End Checklist is currently in beta. Some issues are still being fixed. Thanks for your patience.
SEOMedium

Use valid JSON-LD structured data

Validates JSON-LD structured data for syntax correctness, required properties, and schema.org compliance

Utilities
Quick take
Typical fix time 10 min
  • JSON-LD must be valid JSON, reference `@context: 'https://schema.org'`, and include all required properties for the chosen `@type`
  • Invalid JSON (unclosed brackets, missing commas) causes the entire block to be silently ignored by Google
  • Validate with Google's Rich Results Test before deploying structured data changes
Why it matters: Invalid JSON-LD is silently ignored by Google — there are no error messages in search results, only the absence of rich results. Invalid structured data means no eligibility for rich results (stars, FAQs, breadcrumbs, etc.) that increase click-through rates.

Rule Details

JSON-LD structured data communicates facts about your page to Google in a machine-readable format. A single syntax error makes the entire block invisible to Google, which is why structured data implementation only matters when the JSON-LD itself is valid.

Code Examples

❌ Avoid — invalid JSON (trailing comma)

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "My Article",
  "author": {
    "@type": "Person",
    "name": "Jane Smith",   // <-- trailing comma: invalid JSON
  }
}

❌ Avoid — missing required properties

{
  "@context": "https://schema.org",
  "@type": "Article"
  // Missing: headline, author, datePublished
}

✅ Correct — valid Article JSON-LD

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "How to Optimise Core Web Vitals",
  "author": {
    "@type": "Person",
    "name": "Jane Smith",
    "url": "https://example.com/authors/jane-smith"
  },
  "datePublished": "2024-03-15T10:00:00Z",
  "dateModified": "2024-11-20T14:00:00Z",
  "publisher": {
    "@type": "Organization",
    "name": "Acme Blog",
    "logo": {
      "@type": "ImageObject",
      "url": "https://example.com/logo.png"
    }
  }
}
</script>

✅ Correct — valid BreadcrumbList

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://example.com/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://example.com/blog/"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "How to Optimise Core Web Vitals"
    }
  ]
}
</script>

✅ Programmatic generation to avoid syntax errors

// Always use JSON.stringify — never manually write JSON-LD strings
const schema = {
  '@context': 'https://schema.org',
  '@type': 'Article',
  headline: article.title,
  author: { '@type': 'Person', name: article.authorName },
  datePublished: article.publishedAt,
  dateModified: article.updatedAt,
}
 
// In Next.js
<script
  type="application/ld+json"
  dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
/>

Why It Matters

  • Rich results eligibility: Valid structured data is required to appear as rich results (star ratings, FAQs, recipes, etc.) in Google Search, and Google's structured data introduction (opens in new tab) is the baseline reference for what Google expects.
  • Silent failure: Invalid JSON-LD produces no visible error — only the absence of rich results.
  • Search Console errors: Google Search Console's Rich Results Status report shows structured data errors, but only for pages Google has crawled recently, which is why Google Rich Results Test is still the fastest first check.

Common Validation Errors

ErrorCause
JSON parse errorTrailing comma, single quotes, unescaped characters
Missing @contextOmitted or wrong URL
Wrong @type valueTypo, or using a non-schema.org type
Missing required propertye.g., Article without author
Wrong value typeString where array expected, or vice versa

Validation Tools

Exceptions

  • Only add or enforce schema types that the page can truthfully support; irrelevant structured data is worse than no structured data.
  • A technically valid schema block can still be misleading if the page content does not visibly back it up; audit rendered content and schema together.
  • If indexability, canonical-url, or main content quality is wrong, fix that foundation before optimizing schema details.

Standards

  • Use these references as the standard for the final search-facing HTML, metadata, and crawl behavior.
  • Check the implementation against Google Search Central: Introduction to structured data before treating the rule as satisfied.
  • Check the implementation against Schema.org specification before treating the rule as satisfied.

Verification

Automated Checks

  • Inspect rendered HTML and HTTP headers to confirm the expected metadata or crawlability signal is present.
  • Test the affected URL with Google Search Console or equivalent tooling where relevant.
  • Re-crawl a representative page set after deployment.

Manual Checks

  • Confirm the change does not create conflicting canonical-url, robots, or structured-data signals.

Use with AI

Copy these prompts to use with your AI assistant, or install the MCP server to use directly from Claude, Cursor, or Windsurf.

Check

Verify implementation

Find all `<script type='application/ld+json'>` elements on the page. For each: (1) Attempt to parse the content as JSON — flag syntax errors. (2) Verify `@context` is set to `'https://schema.org'`. (3) Verify `@type` is a valid schema.org type. (4) For the detected type, check required properties are present (e.g., Article requires `headline`, `author`, `datePublished`; Product requires `name`; FAQPage requires `mainEntity`). (5) Run through Google's Rich Results Test API if available.

Fix

Auto-fix issues

1. Parse the JSON-LD with `JSON.parse()` — fix any syntax errors (trailing commas, single quotes, missing brackets). 2. Ensure `@context` is exactly `"https://schema.org"` (not `"http://schema.org"` or omitted). 3. Verify the `@type` value against schema.org types. 4. Add required properties for the type: - Article: headline, author (with @type Person and name), datePublished - Product: name (and ideally offers, description) - FAQPage: mainEntity array with Question and acceptedAnswer - BreadcrumbList: itemListElement array with ListItem, position, name, item 5. Validate at https://search.google.com/test/rich-results 6. Validate JSON syntax at https://jsonlint.com

Explain

Learn more

Google uses JSON-LD structured data to generate rich results — enhanced search result formats that include stars, images, expandable Q&As, and other features. Invalid JSON-LD is ignored entirely: no rich results are generated, and no error is reported to you. Only by testing with the Rich Results Test can you discover validation failures. Correct, complete JSON-LD is a prerequisite for rich result eligibility.

Review

Code review

Extract all `<script type='application/ld+json'>` element contents. Run `JSON.parse()` on each — catch and report parse errors. Validate that `@context` equals `'https://schema.org'`. Check `@type` against a whitelist of common valid types. For each type, validate required properties are present and non-empty. Report the first validation error found for each block.

Sources

References used to support the guidance in this rule.

Further Reading

Tools and supplementary material for exploring the topic in more depth.

Full schema hierarchy - Schema.org

Schema.org is a set of extensible schemas that enables webmasters to embed structured data on their web pages for use by search engines and other applications.

schema.orgSpec
หลักเกณฑ์ทั่วไปเกี่ยวกับ Structured Data | Google Search Central  |  Documentation  |  Google for Developers

ปฏิบัติตามหลักเกณฑ์ทั่วไปสำหรับข้อมูลที่มีโครงสร้าง หลักเกณฑ์เหล่านี้ช่วยให้ข้อมูลที่มีโครงสร้างของคุณมีสิทธิ์แสดงเป็นผลการค้นหาที่เป็นริชมีเดียของ Google

Google for DevelopersGuide
Schema Markup Validator
validator.schema.orgTool
JSONLint
jsonlint.comTool

Rules that often go hand-in-hand with this one.

Add structured data markup

Schema.org structured data (JSON-LD) is implemented for rich search results.

SEO
Add FAQPage schema markup

Validates FAQPage JSON-LD structured data for question-and-answer content

SEO
Add LocalBusiness schema markup

Validates LocalBusiness schema for local SEO

SEO
Add Review schema markup

Validates Review and AggregateRating schema on product, service, and business pages to enable star-rating rich results.

SEO

Was this rule helpful?

Your feedback helps improve rule quality. This stays internal for now.

Loading feedback...
0 / 385