Head or body, both fine
Google says JSON-LD is embedded in a <script> tag in the <head> and <body> elements.
JSON-LD is a JSON-based format for linked data, and Google's recommended way to add structured data. Syntax, @context, @type, and a working example.
JSON-LD is a JSON-based format to serialize Linked Data and a W3C Recommendation since July 2020. In SEO you place it in a script tag with type application/ld+json, so the visible HTML stays untouched. Google lists it as its recommended structured data format and can read it even when it is injected dynamically.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
@context maps short terms to full IRIs, @type says what kind of thing a node is, and @id gives a node an identifier you can reference.<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": "https://example.com/#org",
"name": "Example Co",
"url": "https://example.com"
}
</script><script> element with type="application/ld+json", and multiple script elements per document are supported.Because it is separate from the content, templates and tag managers can output it, and Google reads it when it is injected dynamically.
JSON-LD also doubles as RDF, which is why the same data can feed other linked data tools. For SEO you rarely need that detail. What matters is that a parser reads your block as a graph of nodes, each with a type and properties, and that every node follows the vocabulary you named in @context.
Google says JSON-LD is embedded in a <script> tag in the <head> and <body> elements.
Google reads it when dynamically injected by JavaScript or embedded widgets. Verify with the Rich Results Test URL input, which Google recommends over pasted code.
Don't mark up content that is not visible to readers.
@id to name a node so other nodes can point to it. The W3C spec says @id is used to "uniquely identify node objects that are being described in the document with IRIs or blank node identifiers". A node that contains only @id is a reference to a node described elsewhere in the document. To put several top-level nodes in one script, wrap them in an object with a @graph key whose value is an array of the nodes.Test a combined @graph block in the Rich Results Test before relying on it. Separate script elements also work, and that is the simpler choice if a graph isn't needed.
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://example.com/#org",
"name": "Example Co"
},
{
"@type": "Article",
"headline": "What is JSON-LD?",
"publisher": { "@id": "https://example.com/#org" }
}
]
}@context, so terms don't map to schema.orgapplication/jsonTest the page URL in the Rich Results Test to confirm Google can read the markup, and fix whatever it flags.
When you generate markup from a template, escape quotes and line breaks in titles and descriptions. One unescaped quote in a product name is enough to break the whole block.
4 questions people ask next, answered from the sources on this page.
JSON for Linked Data. The W3C describes it as a JSON-based format to serialize Linked Data.
No. It is a general W3C format for linked data on the web. SEO is one common use.
Yes. The spec supports multiple script elements in a document.
Google says JSON-LD can sit in a <script> tag in either the <head> or the <body>. Use whichever suits your templates.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.