Skip to content

JSON-LD

Also called JavaScript Object Notation for Linked Data, application/ld+json

What is JSON-LD?

JSON-LD (JavaScript Object Notation for Linked Data) is a format for writing structured data as a block of JSON inside a <script type="application/ld+json"> tag. It is the format Google recommends for schema markup because it sits apart from the visible HTML, so you can add, generate and update it without changing your page layout.

Robot arm holds a glowing data capsule over a platform, representing JSON-LD for structured data.

A JSON-LD block starts with @context, normally https://schema.org, and an @type, such as Product or Organization, followed by that type’s properties. Nested objects describe related things. @id gives a node a stable identifier so other blocks can refer to it, and @graph lets you put several connected nodes in one block.

The script can go in the <head> or the <body>, and a page can have more than one block. Google can also read JSON-LD that JavaScript adds to the page after it loads, though markup in the server-rendered HTML is safer for every crawler.

Why JSON-LD matters for SEO

JSON-LD is the simplest way to make pages eligible for rich results. Because it lives in one block, developers can build it from the same data that renders the page, which keeps it accurate, and SEOs can review it without picking through HTML attributes as with Microdata or RDFa.

It is also strict. A single missing comma or stray quote makes the whole block invalid JSON, and search engines ignore it. Template changes that break JSON-LD are a common silent cause of lost rich results.

How to write JSON-LD

  1. Start from Google’s documentation for the type you need, and copy its required properties.
  2. Generate the JSON in code from your page data rather than writing strings by hand, so values are escaped correctly and stay in sync.
  3. Use absolute URLs, ISO 8601 dates (2026-10-01T09:00:00+01:00) and full schema.org enum URLs such as https://schema.org/InStock.
  4. Place the script in the page’s HTML, one block per entity or one @graph block for several.
  5. Validate with the Rich Results Test or the Schema Markup Validator after every template change.

JSON-LD example

JSON-LD (Organization)
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "@id": "https://www.example.com/#organization",
  "name": "Example Ltd",
  "url": "https://www.example.com/",
  "logo": "https://www.example.com/logo.png",
  "sameAs": [
    "https://www.linkedin.com/company/example",
    "https://github.com/example"
  ]
}
</script>

JSON-LD FAQ

Is JSON-LD better than Microdata?

For most sites, yes. Google supports both but recommends JSON-LD because it is separate from the HTML and easier to maintain. Search engines treat valid markup in either format the same.

Where should JSON-LD go, head or body?

Either works. Google reads JSON-LD in the head or the body, and a page can have several blocks.

Can JSON-LD be added with JavaScript or Google Tag Manager?

Google can read JSON-LD injected with JavaScript once it renders the page, but server-rendered markup is more reliable and works for crawlers that do not run JavaScript.

Related SEO terms

  • Structured data

    Structured data is code in a standard format that describes a page’s content to search engines, making it eligible for rich results.

  • Schema markup

    Schema markup is structured data that uses the schema.org vocabulary to describe things on a page, such as products, articles and businesses.

  • Rich results

    Rich results are Google search results with extra visual features, such as star ratings, prices or event dates, usually powered by structured data.

  • JavaScript SEO

    JavaScript SEO is the work of making sure search engines can crawl, render and index content and links that a site builds with JavaScript.

  • Entity

    An entity is a distinct, identifiable thing, such as a person, place, organisation or product, that search engines and AI models recognise.

  • Structured data spamBlack hat

    Structured data spam is schema markup that misleads, such as fake review stars or markup for content not on the page, to win rich results.

Back to the SEO glossary

Put the terms to work

Every term here is something OpenSEO measures. It is open source: start online in a minute, or run it on your own server.