Sub topic 11
Checking Your Markup with Validators
This chapter assumes you can write JSON-LD with @context, @type, nested entities, and @id. It also assumes you can place a script element of type application/ld+json in an HTML page. Here you will learn which tools check that markup, what each one tells you, and how to fix the errors they report.
Why validation needs more than one tool
Markup can fail at three separate levels:
- Syntax. The JSON is malformed, so no parser can read it.
- Vocabulary. The JSON is valid, but it uses a type or property that schema.org does not define, or puts a value where the property does not expect it.
- Eligibility. The markup is valid schema.org, but it lacks the properties a search engine requires for a particular rich result.
No single tool checks all three. A page can pass a vocabulary check and still produce no rich result. It can also qualify for a rich result and still use a property incorrectly. You will usually run two tools and a JSON parser.
| Tool | Checks | Does not check |
|---|---|---|
| JSON parser or linter | Syntax | Meaning |
| Schema Markup Validator | Syntax and schema.org vocabulary | Search engine eligibility |
| Rich Results Test | Google's required and recommended properties | Every schema.org type |
| Search Console reports | Real pages as Google crawled them | Pages Google has not yet seen |
Level 1: check the syntax
Syntax errors are the most common reason markup is ignored. A search engine that cannot parse the block skips it, usually without any visible warning on the page.
The usual causes are:
- A trailing comma after the last property in an object or array.
- Single quotes instead of double quotes.
- An unescaped double quote inside a string.
- A missing comma between two properties.
- A comment. JSON has no comment syntax.
The following block looks fine but contains two errors:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Brew "Cold" Coffee",
"datePublished": "2026-03-14T08:00:00+00:00",
}The quotes around Cold end the string early, and the comma after the last property is not allowed. The corrected version escapes the inner quotes and removes the comma:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Brew \"Cold\" Coffee",
"datePublished": "2026-03-14T08:00:00+00:00"
}You can check syntax before any web tool by running the block through a parser. This Python script reads a file and reports the line and column of the first error:
import json
import sys
path = sys.argv[1]
with open(path, encoding="utf-8") as f:
text = f.read()
try:
data = json.loads(text)
except json.JSONDecodeError as err:
print(f"Invalid JSON at line {err.lineno}, column {err.colno}: {err.msg}")
sys.exit(1)
print("Valid JSON. Top-level type:", data.get("@type", "(none)") if isinstance(data, dict) else "array")Save it as check_json.py, put the JSON block in article.json, and run python check_json.py article.json.
Level 2: the Schema Markup Validator
The Schema Markup Validator (validator.schema.org) is the general-purpose checker maintained for schema.org. It accepts either a URL or a pasted code snippet. It parses the markup, lists each entity it finds, and reports problems against the schema.org vocabulary. It is not tied to any search engine, so it does not judge whether you qualify for a rich result.
Typical findings include:
- Unknown type. You wrote
"@type": "Artical". The validator cannot match it to a schema.org type. - Unknown property. You used a property the type does not define, such as
"authorName"on anArticle. - Unexpected value type. A property that expects an entity received a plain string, or the reverse.
Use the snippet option while you write the markup, and the URL option once the page is live. They test different things. A snippet tests your JSON. A URL tests what the server actually delivers, including any script that your template or framework changed on the way.
Level 3: the Rich Results Test
The Rich Results Test is Google's tool. It checks whether a page or snippet is eligible for Google's rich result features, such as product snippets or breadcrumb trails. It reports only the types Google supports for rich results. A valid Organization block may appear in the Schema Markup Validator but be ignored here if it does not map to a rich result feature.
Its messages fall into two groups:
- Errors mean a required property is missing or has an invalid value. The item is not eligible for the rich result.
- Warnings mean a recommended property is missing. The item can still be eligible, but you give up information that may improve the result.
For example, a Product that lacks offers produces an error for a product snippet. A Product without aggregateRating produces no error, because that property is optional. Requirements differ for each feature and change over time, so read Google's current documentation for the type you are marking up.
The test can fetch a URL or take pasted code. Fetching a URL shows what Googlebot sees. If the markup is added by JavaScript, the tool renders the page, so it shows whether the markup survives rendering. A snippet test cannot show you that.
Level 4: Search Console
Search Console reports on pages Google has actually crawled. Under the Enhancements section, it lists a report for each supported type it has detected on your site, with counts of valid items, items with warnings, and items with errors. It groups pages by the problem, so you can fix one template and clear many pages at once.
This is the only tool that shows trends over time. It is also slow: after you fix a problem, you can ask Google to validate the fix, and the check may take days. Use the Rich Results Test for fast feedback, and use Search Console to confirm the fix at scale.
A repeatable workflow
Run the cheapest check first. A JSON error caught locally costs seconds. The same error found in Search Console costs days.
Worked example: fixing a Product
Here is a Product with problems that different tools catch:
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Stainless Steel Pour-Over Kettle",
"image": "https://example.com/images/kettle.jpg",
"offers": {
"@type": "Offer",
"price": 39.90,
"priceCurrency": "Euro",
"availability": "InStock"
}
}The JSON is valid, so the syntax check passes. The other checks find these issues:
priceCurrencyshould be an ISO 4217 code such asEUR, not the wordEuro.availabilityshould be the schema.org URLhttps://schema.org/InStock. A bareInStockis a plain string, not an enumeration value.priceis better written as the string"39.90". A JSON number drops trailing zeros, which can change how the value reads.- The Rich Results Test may warn that
descriptionandurlare missing.
The corrected block:
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Stainless Steel Pour-Over Kettle",
"image": "https://example.com/images/kettle.jpg",
"description": "A 1-liter gooseneck kettle for pour-over coffee.",
"offers": {
"@type": "Offer",
"price": "39.90",
"priceCurrency": "EUR",
"availability": "https://schema.org/InStock",
"url": "https://example.com/products/kettle"
}
}What validators cannot catch
Validators check structure. They cannot check whether the markup tells the truth. These problems pass every tool:
- A price in the markup that differs from the price on the page.
- A rating or review that the page does not show to visitors.
- An
Articleauthor who is not named anywhere on the page. - A
dateModifiedthat was never updated after an edit.
Search engine guidelines require markup to match the visible content. Markup that misleads can lead to a manual action, which removes your rich results. Compare the markup with the rendered page yourself, or add a test that does so.
Checking from a build or test suite
For generated markup, add an automated check so errors fail the build instead of reaching production. A minimal version extracts every JSON-LD block from a page and parses it:
import json
import re
html = """
<html><head>
<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "Organization", "name": "Example Coffee Co."}
</script>
</head><body></body></html>
"""
pattern = re.compile(
r'<script type="application/ld\+json">(.*?)</script>',
re.DOTALL,
)
blocks = pattern.findall(html)
assert blocks, "No JSON-LD found"
for raw in blocks:
data = json.loads(raw)
assert "@context" in data, "Missing @context"
assert "@type" in data, "Missing @type"
print(f"{len(blocks)} block(s) parsed")This catches syntax errors and missing keywords. It does not replace the two web tools, which know the vocabulary and Google's requirements.
Summary
- Validate at three levels: syntax, vocabulary, and eligibility.
- Use the Schema Markup Validator for vocabulary and the Rich Results Test for Google features.
- Treat errors as blocking and warnings as optional improvements.
- Use Search Console to find problems across a whole site.
- Check by hand that the markup matches what visitors see.
Exercise
A page's JSON-LD passes the Schema Markup Validator with no issues, but the Rich Results Test reports an error for a Product and shows no eligible items. Give two likely causes and say which tool you would use to confirm each.
Show answer
One cause is a missing required property for Google's product feature, such as offers. The Rich Results Test names the missing property, so read its error list. Another cause is that the markup is injected by JavaScript and does not appear after rendering, or that the live page differs from the snippet you tested. Confirm by testing the live URL in the Rich Results Test and comparing the rendered output with your snippet. The Schema Markup Validator passed because it only checks the schema.org vocabulary, not Google's eligibility rules.
Exercise
Why is "availability": "InStock" weaker than "availability": "https://schema.org/InStock", even though the JSON is valid either way?
Show answer
availability expects an enumeration value, which is identified by its schema.org URL. The bare string InStock is only text, so a consumer may not recognize it as the enumeration member. Validators or search engines can then flag it or ignore it.