Structured dataBeginner

JSON-LD

JSON-LD is a JSON-based format for structured data, placed in a script tag, and it is the format Google recommends for Schema.org markup.

Also called: JavaScript Object Notation for Linked Data

JSON-LD stands for JavaScript Object Notation for Linked Data. It is a W3C standard for expressing linked data in ordinary JSON. For SEO it means a script block of type application/ld+json that describes the page using Schema.org types, kept separate from the visible HTML. Google recommends it over Microdata and RDFa because it is easier to write, generate and maintain.

What it looks like

A JSON-LD block declares a @context, which tells parsers which vocabulary the terms come from, and a @type, which names the Schema.org type. Properties follow as normal JSON keys. Nested objects describe related entities, such as the author of an article or the offer on a product.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "Ferncastle",
  "url": "https://www.ferncastle.example",
  "logo": "https://www.ferncastle.example/logo.png"
}
</script>

Why it is the default choice

Because the markup is not woven into the HTML, designers can change templates without breaking it, and developers can generate it from the same data that renders the page. It can sit in the head or the body. Multiple blocks on one page are fine, and so is a single block holding an @graph array of several connected entities.

Google can read JSON-LD injected by JavaScript, as long as the page renders properly in its rendering service. Server-rendered markup is still the safer option, since it does not depend on rendering and is visible to crawlers that do not execute JavaScript.

Linked data features worth knowing

The LD part matters once a site has many connected entities. The @id keyword gives an entity a stable identifier, usually a URL with a fragment, so other blocks can refer to it rather than repeat it. The sameAs property links an entity to its profiles elsewhere. Together they let a site describe one company, one set of authors and many pages without contradictions.

Example

Generating JSON-LD from CMS fields

A data tooling startup, Glintmoor, stores article title, author, publish date and hero image as fields in its headless CMS. A shared component reads those fields and outputs a BlogPosting JSON-LD block at render time, so the markup always matches what the page shows and never needs hand edits.

Common mistakes

Invalid JSON

A trailing comma, a smart quote pasted from a document or an unescaped quote inside a string breaks the whole block. Validate after every template change.

Marking up content that is not on the page

Google's guidelines require structured data to describe content visible to users. JSON-LD makes it easy to add facts that are nowhere in the HTML, which can make the page ineligible for rich results.

Questions

Either works. Google reads it in both places. Put it wherever your framework makes it easiest to keep in sync with the page content.

Yes. Several blocks, or one block with an @graph array, are both valid. Keep entities consistent across them and use @id to connect them.

Know the terms. Now win the searches.

We find the searches your buyers make, then build, publish and improve the pages that win them.