# What is JSON-LD?

> JSON-LD (JavaScript Object Notation for Linked Data) is a W3C format for writing structured data as JSON inside a script tag; Google recommends it.

URL: https://yes-seo.com/glossary/json-ld

**JSON-LD** — JavaScript Object Notation for Linked Data — is a way of writing structured data as plain JSON. It is a [W3C Recommendation](https://www.w3.org/TR/json-ld11/) and the format Google recommends for [schema markup](https://yes-seo.com/glossary/schema-markup), because it lives in its own block instead of being woven through your HTML.

## Where it goes

JSON-LD sits inside a script element with a special type. Browsers don’t execute it; crawlers read it. It may go in the `<head>` or anywhere in the `<body>`.

```

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://example.com/#org",
      "name": "Green Sill",
      "url": "https://example.com/",
      "sameAs": ["https://www.linkedin.com/company/green-sill"]
    },
    {
      "@type": "WebSite",
      "@id": "https://example.com/#website",
      "url": "https://example.com/",
      "name": "Green Sill",
      "publisher": { "@id": "https://example.com/#org" }
    }
  ]
}

```

## The keywords that matter

- `@context` declares the vocabulary — for SEO, `https://schema.org`.

- `@type` names the kind of thing: Organization, Product, Event and so on.

- `@id` gives a node a stable identifier, usually a URL plus a fragment, so other nodes can reference it instead of repeating it.

- `@graph` holds several connected nodes in one block, as above, where the WebSite points to its publisher by ID.

## Why it matters

JSON-LD makes a page eligible for [rich results](https://yes-seo.com/glossary/rich-results) and gives search engines and AI systems an unambiguous summary of the entities and facts on it. Because it’s separate from the layout, a template change won’t break it, and it is simple to output from a CMS or product database. Google’s [structured data introduction](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data) lists the supported formats and the policies that apply.

## Common mistakes

- **Invalid JSON.** A trailing comma, a missing quote or curly “smart quotes” pasted from a word processor invalidate the whole block, and every item in it.

- **Unescaped characters.** A double quote inside a product name needs a backslash, and a literal closing script tag inside a text value ends the block early.

- **Duplicated entities** across several blocks with different values, often from multiple plugins.

- **JavaScript-only injection.** Google can read JSON-LD added by scripts after rendering, but crawlers that don’t run JavaScript, including many AI bots, never see it. Output it in the server HTML.

- **HTML inside values**, such as paragraph tags in a description field.

Generate JSON-LD with your language’s JSON encoder — `json_encode()` in PHP, `JSON.stringify()` in JavaScript — rather than by gluing strings together. Encoders handle quotes and special characters for you.

## Validate it

Run the page through the [schema validator](https://yes-seo.com/schema-validator): it extracts every JSON-LD block alongside any Microdata or RDFa, reports JSON syntax errors, and checks Google’s required and recommended properties for common types. For the concepts behind it, see [structured data](https://yes-seo.com/glossary/structured-data).

## Frequently asked questions

### Is JSON-LD better than Microdata?

For most sites, yes. Google supports JSON-LD, Microdata and RDFa, but recommends JSON-LD because it is separate from the visible HTML and easier to generate and maintain.

### Can a page have more than one JSON-LD block?

Yes. Search engines read all of them. Just make sure the blocks don’t describe the same entity with conflicting values; linking nodes with @id inside one @graph keeps things tidy.

### Does JSON-LD slow down a page?

Hardly. It is a small block of text that browsers don’t execute. Even a detailed product graph is usually just a few kilobytes.

