Sub topic 3
Checking JSON-LD Markup
Assume you know basic HTML, JSON objects and arrays, URLs, and how pages are published. Validators check syntax and vocabulary use, but they do not prove that your markup accurately describes the visible page.
Checking Your Markup with Validators
Use the Schema Markup Validator to check JSON-LD against schema.org types and properties. It can reveal invalid properties, missing expected values, and incorrect value types.
Use Google's Rich Results Test to check whether Google can read supported markup for a page. A valid result does not guarantee a rich result. Eligibility also depends on Google's rules, page quality, indexing, and visible content.
Test both the source code and a published URL. Fix JSON syntax errors first, then vocabulary errors, then content mismatches.
> callout note > Structured data is a description of page content, not a way to add invisible claims. The marked-up information should be available to visitors on the page.
Search Engine Use and Safe Generation
Search engines may use structured data to understand entities and display enhanced results. They can ignore markup that is incomplete, misleading, unsupported, or inconsistent with the page. Structured data does not directly guarantee higher rankings.
Generate JSON-LD from trusted application data rather than concatenating strings. Serialize values with a JSON library and escape </ before placing the result inside a script element.
import json
article = {
"@context": "https://schema.org",
"@type": "Article",
"headline": "Cold Coffee Guide",
"author": {"@type": "Person", "name": "Ana Torres"},
}
payload = json.dumps(article, ensure_ascii=False).replace("</", "<\\/")
print(f'<script type="application/ld+json">{payload}</script>')Less Common JSON-LD Features
Use @language for a default language, @list when order matters, and @set when a value should always be treated as a set.
{
"@context": {
"@language": "en",
"keywords": { "@container": "@set" }
},
"@type": "Article",
"keywords": ["coffee", "brewing"]
}Alternative Syntaxes and Maintenance
Microdata adds attributes such as itemscope and itemprop directly to HTML elements. RDFa uses attributes such as vocab, typeof, and property. JSON-LD keeps the data in a separate script block, which usually makes templates easier to maintain.
Review markup whenever editors change titles, prices, authors, URLs, or page templates. Remove stale entities and retest after deployment.
Exercise
Does a passing Rich Results Test guarantee that Google will show an enhanced result?
Show answer
No. It shows that the markup is eligible for consideration. Google still applies its guidelines, indexing systems, and presentation decisions.