Sub topic 6
Expressing Facts in JSON-LD
Assume you know basic HTML, JSON, and how a crawler reads a web page. JSON-LD is a JSON format for describing a page’s facts to search engines and other systems. It does not replace visible content. It gives machines a structured version of facts that people can already see.
The working model
Place JSON-LD in a script element with the type application/ld+json, usually in the page head or body. The document uses:
@contextto identify the vocabulary, usually Schema.org.@typeto identify the thing being described, such asArticleorProduct.- Properties such as
headline,datePublished,price, andavailabilityto describe that thing.
A page can contain more than one JSON-LD object. Use an @graph when several related objects belong to the same page.
Article dates in JSON-LD
For an article, datePublished records the original publication time. dateModified records the most recent meaningful change. Use ISO 8601 timestamps, including a time zone when the time is known.
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to choose trail running shoes",
"datePublished": "2026-03-02T09:00:00+00:00",
"dateModified": "2026-11-20T08:00:00+00:00"
}A date in JSON-LD does not make an article “fresh” by itself. The visible page should show equivalent information, and the modified date should change only when the article actually changes.
Product and Offer facts
Product markup describes an item. An Offer describes the transaction details, including price, currency, availability, and sometimes the period for which the price is valid.
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Trail Runner 2",
"sku": "TR2-BLK-42",
"offers": {
"@type": "Offer",
"url": "https://example.com/p/trail-runner-2",
"price": "89.00",
"priceCurrency": "EUR",
"priceValidUntil": "2026-12-31",
"availability": "https://schema.org/InStock"
}
}The price and stock state must match the page a customer can access. If the product is out of stock, do not leave InStock in the markup while the visible page says otherwise.
| Fact | Example | Common requirement |
|---|---|---|
| Product name | Trail Runner 2 | Match the visible product name |
| Price | 89.00 | Use the page’s current selling price |
| Currency | EUR | Use the correct ISO 4217 code |
| Availability | InStock | Match the current stock state |
Common errors and checks
Common mistakes include copying JSON-LD between products, leaving old prices in cached templates, using a future dateModified, and publishing two conflicting Product objects. Unsupported or misspelled properties may be ignored.
Generate JSON-LD from the same product or article record that renders the page. Then test both representations:
- Compare every marked-up price, currency, name, and availability value with the visible page.
- Check that dates use valid ISO 8601 values.
- Validate the JSON syntax and Schema.org types.
- Inspect the final rendered HTML, not only a source template.
- Alert when a product record and its markup disagree.
Exercise
A product page visibly shows EUR 89.00 and “Out of stock,” but its JSON-LD says price 79.00 and InStock. What should you change?
Show answer
Fix the shared product source or rendering logic so both the visible page and JSON-LD show EUR 89.00 and OutOfStock, then validate the rendered page.