Blog

SEO 8 min read

JSON-LD structured data: ready-to-use examples and a PHP generator

JSON-LD is the format Google recommends for structured data. This guide explains what to mark up, shows copy-ready examples for the most useful schema.org types, and the small PHP pattern we use to generate valid markup on every page without hand-writing JSON.

Cover illustration: JSON-LD structured data: ready-to-use examples and a PHP generator

TL;DR

  • JSON-LD is a <script type="application/ld+json"> block in the page that describes it to machines, using schema.org vocabulary.
  • Mark up only what users can see on the page. Markup that does not match the content risks a manual action and gains nothing.
  • Start with Organization, BreadcrumbList and Article or Product; add FAQPage, Service or LocalBusiness where they fit.
  • Generate JSON in PHP from arrays with json_encode, one @graph per page, with stable @id values.
  • Validate templates with the Rich Results Test and the Schema Markup Validator, and monitor Search Console enhancement reports.

JSON-LD structured data is a way to tell search engines, in a machine-readable form, what a page is: an article, a product with a price, a company with contact details, a list of questions and answers. It is invisible to visitors, it does not replace good content, and it does not by itself raise rankings. What it does is make a page eligible for rich results, help engines connect your pages to the right entity and give AI-based search a cleaner source to read. We generate it on every page of integrono.com and our other sites, and this guide is the practical version of that work.

JSON-LD vs Microdata vs RDFa

Schema.org vocabulary can be embedded in three syntaxes. Microdata and RDFa put attributes into your HTML tags, which tangles markup with templates. JSON-LD lives in one script block, separate from the layout, so it is easier to generate, test and change. Google states it recommends JSON-LD, and it is what we use everywhere.

Principles before examples

  • Describe visible content. If the price, rating or FAQ is not on the page, do not put it in the markup.
  • Use absolute URLs and the canonical URL of the page.
  • Be complete for required properties, and add recommended ones when you have real data.
  • Use @id to link entities. The article's author is the organisation defined once with an @id, not a new copy each time.
  • Use dates in ISO 8601 (2026-10-28 or with a time and zone).
  • Do not invent reviews or ratings. Fake AggregateRating data is a common cause of manual actions.

Example 1. Organization (and WebSite)

Put this on the home page or in a site-wide graph. It defines the entity other markup refers to.

{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://example.com/#organization",
  "name": "Example Studio",
  "url": "https://example.com/",
  "logo": "https://example.com/images/logo.png",
  "email": "[email protected]",
  "sameAs": [
    "https://github.com/example",
    "https://www.linkedin.com/company/example"
  ]
}

Example 2. BreadcrumbList

Breadcrumb markup lets Google show the page path instead of a raw URL in the results. It must match the visible breadcrumbs.

{
  "@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": "JSON-LD guide", "item": "https://example.com/blog/json-ld-guide"}
  ]
}

Example 3. Article

For blog posts and guides. The properties that matter: headline, dates, author, publisher, image and the page URL.

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "JSON-LD structured data: examples",
  "description": "Short summary of the article.",
  "url": "https://example.com/blog/json-ld-guide",
  "mainEntityOfPage": "https://example.com/blog/json-ld-guide",
  "inLanguage": "en",
  "datePublished": "2026-08-23",
  "dateModified": "2026-10-28",
  "author": {"@id": "https://example.com/#organization"},
  "publisher": {"@id": "https://example.com/#organization"},
  "image": {"@type": "ImageObject", "url": "https://example.com/images/blog/json-ld.webp", "width": 1200, "height": 630}
}

Change dateModified only when the content really changes. Bumping it on every deploy is a quiet way to lose trust.

Example 4. Product with Offer

For product pages with a visible price. Include availability and currency; add aggregateRating or review only if real reviews are shown on the page.

{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Example product",
  "description": "What it is and who it is for.",
  "image": ["https://example.com/images/product.webp"],
  "sku": "EX-001",
  "brand": {"@type": "Brand", "name": "Example"},
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/product/ex-001",
    "priceCurrency": "EUR",
    "price": "49.00",
    "availability": "https://schema.org/InStock",
    "itemCondition": "https://schema.org/NewCondition"
  }
}

Example 5. Service with Offer

For paid services, such as a fixed-price audit or an hourly consultation. We use this pattern on our own service pages.

{
  "@context": "https://schema.org",
  "@type": "Service",
  "name": "Architecture review",
  "serviceType": "Software architecture analysis",
  "provider": {"@id": "https://example.com/#organization"},
  "areaServed": "Worldwide",
  "offers": {
    "@type": "Offer",
    "price": "200",
    "priceCurrency": "EUR",
    "url": "https://example.com/services/architecture-review"
  }
}

Example 6. FAQPage

FAQ markup describes a list of questions and answers that are visible on the page. Be aware that since 2023 Google shows FAQ rich results only for a limited set of authoritative sites, so do not expect expandable answers in the results. The markup is still valid, still readable by other search engines and AI systems, and it keeps the FAQ structured in a way machines can quote.

{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Do I need structured data to rank?",
      "acceptedAnswer": {"@type": "Answer", "text": "No. It is not a ranking requirement, but it can make pages eligible for rich results."}
    }
  ]
}

Combine everything in one @graph

A page rarely has just one entity. Put all of them in one script using @graph, and refer to shared entities by @id:

{
  "@context": "https://schema.org",
  "@graph": [
    {"@type": "Organization", "@id": "https://example.com/#organization", "name": "Example Studio"},
    {"@type": "Article", "headline": "...", "author": {"@id": "https://example.com/#organization"}},
    {"@type": "BreadcrumbList", "itemListElement": []},
    {"@type": "FAQPage", "mainEntity": []}
  ]
}

Generating JSON-LD safely in PHP

Do not concatenate JSON by hand. A quote in a title breaks the whole script and the search engine silently ignores it. Build a PHP array and encode it. Two flags matter: keep Unicode readable and protect the HTML context by escaping slashes and tags.

function jsonLdScript(array $graph): string
{
    $data = ['@context' => 'https://schema.org', '@graph' => $graph];
    $json = json_encode(
        $data,
        JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_THROW_ON_ERROR
    );
    return '<script type="application/ld+json">' . $json . '</script>';
}

$graph = [
    ['@type' => 'Organization', '@id' => $site . '/#organization', 'name' => 'Example Studio', 'url' => $site . '/'],
    [
        '@type'         => 'Article',
        'headline'      => $title,
        'url'           => $canonical,
        'datePublished' => $published,
        'dateModified'  => $modified,
        'author'        => ['@id' => $site . '/#organization'],
    ],
];
echo jsonLdScript($graph);

JSON_HEX_TAG turns < and > into escape sequences so that user content can never close the script tag early. Feed the generator from the same data that renders the page (title, price, dates), so markup and visible content cannot drift apart. In a multilingual site, translate text fields and set inLanguage per locale; this is how this blog's articles and FAQ markup are produced.

Validate and monitor

  1. Rich Results Test for eligibility of Google's rich result types.
  2. Schema Markup Validator for general schema.org syntax of any type.
  3. Search Console enhancement reports (breadcrumbs, products, FAQ and so on) for errors and warnings at scale, after Google has crawled your pages.
  4. A unit test that renders each template and checks that the JSON-LD parses and contains the required keys prevents regressions after refactors.

Mistakes that cost you

  • Markup for content that is not on the page (hidden FAQ, invented ratings, prices that differ from the visible price).
  • Several conflicting blocks from a plugin and a template, each with a different Organization.
  • Relative URLs, wrong dates or a missing @id.
  • Broken JSON from manual string building and unescaped quotes.
  • Treating schema as a ranking trick. It is a clarity tool; the page still has to deserve to rank.

How we can help

Structured data is one part of our technical SEO work: we design the schema for your templates, implement the generator in your stack and set up validation so it stays correct after releases. If you want an overview of what is wrong across your site, begin with our technical SEO audit checklist or book a consultation.

Frequently asked questions

What is JSON-LD structured data?

JSON-LD is a script block containing schema.org data in JSON format that describes the content of a page to search engines, for example an article, product, organisation or FAQ.

Does structured data improve rankings?

Not directly. It helps search engines understand the page and can make it eligible for rich results, which may improve click-through rate, but it is not a ranking requirement.

Where do I put the JSON-LD script?

Anywhere in the HTML head or body of the page; most sites put it in the head. It must be present in the rendered HTML that Google fetches, so server-side generation is the safest approach.

Is FAQPage markup still worth adding?

Google now shows FAQ rich results only for a limited set of sites, but valid FAQ markup remains readable by other search engines and AI systems. Add it only for questions and answers that are visible on the page.

How do I test structured data?

Use Google's Rich Results Test for eligible rich results, the Schema Markup Validator for general syntax and the Search Console enhancement reports to track errors across the whole site.

Free discovery call

Bring a messy stack or stalled integration - Integrono will map the smartest first move.

You get a senior take on budget traps, dependencies and whether to buy, glue or build - before paid work starts. The CEO stays in the loop.