What is JSON-LD?
JSON-LD is the structured data format Google recommends: a script block of labeled facts about the page, kept separate from the visible HTML.
Updated
JSON-LD (JavaScript Object Notation for Linked Data) is a way to write structured data as a block of JSON inside a <script type="application/ld+json"> tag. It is the format Google recommends, because it is separate from the visible HTML and easy to add, generate and update.
What does JSON-LD look like?
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Trail Runner 2 shoe",
"image": "https://shop.example/img/trail-runner-2.jpg",
"offers": {
"@type": "Offer",
"price": "129.00",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock"
}
}
</script>@contextnames the vocabulary, almost always schema.org.@typesays what the thing is: Product, Article, LocalBusiness, Event and so on.@id(optional) gives a node a stable identifier so other nodes can refer to it, which is how one page’s Organization, WebSite and Article are linked together in a graph.
Where should JSON-LD go?
In the <head> or the <body>; Google reads both. It can also be injected with JavaScript, as long as it is in the rendered page. Keep the values in sync with what the page shows: a price in JSON-LD that differs from the visible price breaks Google’s guidelines.
How do I test it?
Paste the URL into the schema checker or Google’s Rich Results Test. Search Console also reports structured data errors for the rich result types it supports.