beginner7 min readยทSchema Markup

JSON-LD Best Practices for AEO

JSON-LD is Google's preferred schema format - placed in a script tag in the head or body, it separates markup from HTML while being fully machine-readable.

Reading level:

JSON-LD (JavaScript Object Notation for Linked Data) is the format Google recommends for all structured data markup. It is embedded in a <script type="application/ld+json"> tag in your page's <head> and describes your content in a machine-readable format that Google, Bing, and other systems parse separately from your visible HTML. Understanding how to write valid, correctly structured JSON-LD is the technical foundation for all AEO schema work.

The most critical rule for beginners: JSON-LD must be valid JSON before it can be valid schema. JSON has strict syntax rules - property names must be in double quotes, string values must be in double quotes (not single quotes), trailing commas after the last item are not allowed, and special characters in strings must be escaped. A single misplaced comma or missing quotation mark makes the entire schema block invisible to Google's parser. Always validate the JSON syntax first with a JSON linter, then validate the schema content with Google's Rich Results Test.

Spot the JSON-LD Errors: Common Mistakes in Organization Schema

The code block below contains 5 common JSON-LD errors found in real-world schema audits. Click any highlighted line to reveal the error, the fix, and its impact on rich result eligibility.

organization-schema.json - 5 errors hidden
{
  "@context": "http://schema.org",
  "@type": "organisation",
  "Name": "Acme Corp",
  "sameAs": "https://linkedin.com/company/acme",
  "logo": "https://acmecorp.com/logo.png"
}
Click any highlighted line to reveal the error and fix0/5 revealed

JSON-LD Syntax Rules: What Every Implementation Must Follow

JSON-LD has both JSON syntax rules (which any JSON parser enforces) and schema.org/Google semantic rules (which determine whether schema is eligible for rich results). A valid schema.org declaration in invalid JSON is completely invisible to Google - JSON validity comes first.

Placement: always in <head>

Place all JSON-LD blocks inside the <head> element, not in the <body>. While Google's parser can technically extract JSON-LD from the body, placing it in the head ensures it is processed before page rendering begins - important for pages where structured data affects rendering pipeline decisions. For Next.js and React applications, add JSON-LD via a <Script> component with strategy='beforeInteractive' or inside the <Head> component to guarantee head placement in the rendered HTML.

Frequently Asked Questions

Related Topics