A standard-library script that compares names, prices and FAQ answers in your structured data with the text on your own pages, and explains every field it skips
JSON-LD is easy to forget after a page edit. Someone updates the price in a template, but the Offer still has last year's number. The JSON is valid, so a syntax check passes even though the two don't match.
This script checks for that on pages you run. It uses only Python's standard library and was tested on Python 3.14.3. It reads saved HTML files or requests the URLs you give it, and it never changes a page.
Disclosure: This article is published by TheLogic, a Korean generative engine optimization agency. You don't need its service to use this script.
TL;DR
-
OKmeans the script found the value in the page text. -
MISSINGmeans it didn't. Check the page before you change anything. -
REVIEWmeans a person needs to decide. -
SKIPmeans the field wasn't compared, and the output says why. -
ERRORmeans a page or JSON-LD block couldn't be read.
Contents
- What Google requires
- What the script compares
- A synthetic test page
- The script
- The real output
- Edge cases and limits
- FAQ
What does Google say about hidden structured data?
Google's structured data policies say not to mark up content that readers of the page can't see. If JSON-LD describes a performer, for example, the page's HTML has to describe that performer too. The page was last updated on 2026-07-10, and it was checked on 2026-12-01.
Google's AI features guide also recommends that structured data match the visible text. It says AI Overviews and AI Mode don't need any special schema. Fixing a mismatch makes your data more accurate, but it doesn't guarantee that you'll appear in either one.
FAQ markup needs a caveat. Google stopped showing FAQ rich results in May 2026 and removed the documentation in June. If you still publish FAQPage data, check that it's accurate, but don't add it to get that rich result.
This script can't decide whether a page breaks Google's policy. It looks for matching text, and Google doesn't say every value has to appear word for word.
Which JSON-LD values should match the page?
The script checks values that readers would normally see:
| Type | Compared | How |
|---|---|---|
| Organization, Corporation, LocalBusiness | name |
Normalized text |
| Product, Service |
name, description
|
Text. A description with different wording is REVIEW
|
| Offer, AggregateOffer and two price specification types |
price, lowPrice, highPrice
|
Number and currency |
| Question, Answer |
name, text
|
Normalized text |
It doesn't flag @id, url, logo, image, sameAs, availability or priceCurrency as missing. Those are identifiers, links, files or codes, not text people read. Each one gets a SKIP line with the reason. Any other field is marked as not covered, so you won't mistake it for a pass.
What does the test page contain?
Save this as sample.html. Everything in it is synthetic. It has an @graph, an array of offers, a split-up Korean won price, a US dollar price that's out of date, an FAQ answer that doesn't match and a block with invalid JSON.
<!doctype html>
<html lang="en">
<head>
<title>Example Studio plans</title>
<script type="application/ld+json">
{"@context": "https://schema.org", "@graph": [
{"@type": ["Organization"], "@id": "https://example.com/#org",
"name": "Example Studio", "url": "https://example.com/",
"logo": "https://example.com/logo.png"},
{"@type": "Service", "name": "Care plan",
"provider": {"@id": "https://example.com/#org"},
"offers": [
{"@type": "Offer", "price": 3000000, "priceCurrency": "KRW"},
{"@type": "Offer", "price": "39.00", "priceCurrency": "USD"}]}
]}
</script>
<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{
"@type": "Question", "name": "Can I get a refund?",
"acceptedAnswer": {"@type": "Answer",
"text": "<p>Yes. Ask within 30 days of payment.</p>"}}]}
</script>
<script type="application/ld+json">{"@type": "Service", "name": "Old plan",}</script>
</head>
<body>
<h1>Example Studio</h1>
<h2>Care plan</h2>
<p>₩3,<b>000</b>,000 per month, or <s>$39</s> $49 for a single check.</p>
<p hidden>Ask within 30 days of payment.</p>
<h3>Can I get a refund?</h3>
<p>Yes. Ask within 14 days of payment.</p>
<p>All names, prices and terms on this page are made up for a script test.</p>
</body>
</html>
There are two traps. The old $39 price is crossed out, and the 30-day refund text is hidden. The script ignores both, so neither one counts as a match.
How does the script compare the values?
Save this as check_jsonld.py:
#!/usr/bin/env python3
"""Compare selected JSON-LD values with the visible text of your own pages.
Usage: python check_jsonld.py page.html https://your-site.example/pricing
Tested on Python 3.14.3, standard library only. Exit code 1 means MISSING or ERROR.
"""
import http.client
import json
import re
import sys
import unicodedata
import urllib.request
from decimal import Decimal
from html import unescape
from html.parser import HTMLParser
PRICE_KEYS = {"price", "lowPrice", "highPrice"}
COMPARED = {
**dict.fromkeys(("Organization", "Corporation", "LocalBusiness"), {"name"}),
**dict.fromkeys(("Product", "Service"), {"name", "description"}),
**dict.fromkeys(("Offer", "AggregateOffer", "PriceSpecification",
"UnitPriceSpecification"), PRICE_KEYS),
"Question": {"name"}, "Answer": {"text"},
}
NOT_TEXT = { # never flagged, because nobody reads these as page text
"@id": "node identifier", "url": "link target", "sameAs": "profile links",
"logo": "image file", "image": "image file", "availability": "schema.org code",
"priceCurrency": "currency code, used in the price check",
}
MARKS = { # what may stand before or after an amount
"KRW": (r"₩|KRW", r"원|KRW"), "USD": (r"(?<![A-Z])(?:US)?\$|USD", "USD"),
"EUR": ("€|EUR", "€|EUR"), "GBP": ("£|GBP", "GBP"),
}
NUM = r"(?<![\d.,])(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?(?!\d|[.,]\d)"
VOID = set("area base br col embed hr img input link meta source track wbr".split())
HIDDEN = set("head script style template noscript del s".split())
BLOCK = set("address article aside blockquote body dd details div dl dt footer form h1 h2 h3 "
"h4 h5 h6 header hr li main nav ol p pre section summary table td th tr ul".split())
CLOSES = {"li": {"li"}, "dt": {"dt", "dd"}, "dd": {"dt", "dd"}, "tr": {"tr", "td", "th"},
"td": {"td", "th"}, "th": {"td", "th"}, "body": {"head"}}
class Page(HTMLParser):
def __init__(self, markup):
super().__init__(convert_charrefs=True)
self.stack, self.text, self.blocks, self.ld = [], [], [], None
self.feed(markup)
self.close()
def handle_starttag(self, tag, attrs):
a = {k: v or "" for k, v in attrs}
while self.stack and (self.stack[-1][0] in CLOSES.get(tag, ())
or tag in BLOCK and self.stack[-1][0] == "p"):
self.stack.pop() # closing tags that HTML lets you leave out
if tag in BLOCK or tag == "br":
self.text.append(" ")
if tag == "script" and a.get("type", "").split(";")[0].strip().lower() == "application/ld+json":
self.ld = len(self.blocks)
self.blocks.append("")
if tag not in VOID:
style = re.sub(r"\s", "", a.get("style", "")).lower()
hide = (tag in HIDDEN or "hidden" in a
or "display:none" in style or "visibility:hidden" in style)
self.stack.append((tag, hide or bool(self.stack and self.stack[-1][1])))
def handle_startendtag(self, tag, attrs):
self.handle_starttag(tag, attrs) # HTML ignores the slash in <div/>
def handle_endtag(self, tag):
if tag == "script":
self.ld = None
if tag in BLOCK:
self.text.append(" ")
if any(name == tag for name, _ in self.stack):
while self.stack.pop()[0] != tag:
pass
def handle_data(self, data):
if self.ld is not None:
self.blocks[self.ld] += data
elif not (self.stack and self.stack[-1][1]):
self.text.append(data)
def norm(text):
text = re.sub("[-]", "", unicodedata.normalize("NFKC", text))
text = text.translate(str.maketrans("‘’“”", "''\"\""))
return " ".join(text.split())
def json_text(value):
value = str(value)
if re.search(r"</?(?:p|br|a|ul|ol|li|b|strong|em|i|div|span)\b", value, re.I):
return norm("".join(Page(value).text)) # FAQ answers may contain HTML
return norm(unescape(value))
def contains(value, text):
value = value.casefold()
left = "(?<![0-9a-z])" if re.match("[0-9a-z]", value) else ""
right = "(?![0-9a-z])" if re.search("[0-9a-z]$", value) else ""
return bool(re.search(left + re.escape(value) + right, text.casefold()))
def numbers(pattern, text, scale=1):
return {Decimal(n.replace(",", "")) * scale for n in re.findall(pattern, text)}
def amounts(text, code):
before, after = MARKS.get(code, (re.escape(code), re.escape(code)))
found = numbers(rf"(?:{before})\s*({NUM})(?!\s*[만억])", text)
found |= numbers(rf"({NUM})\s*(?:{after})", text)
if code == "KRW": # 300만 원 is 3,000,000 won
found |= numbers(rf"(?<!억)(?<!억 )({NUM})\s*만\s*원", text, 10000)
return found
def check_price(node, value, text):
code = str(node.get("priceCurrency") or "").strip().upper()
raw = "" if isinstance(value, bool) else str(value).strip()
if not re.fullmatch(NUM, raw, re.ASCII):
return "REVIEW", "not a plain number"
price = Decimal(raw.replace(",", ""))
if price == 0:
return "REVIEW", "zero price, check the wording (Free, 무료) by hand"
if code and price in amounts(text, code):
return "OK", f"{code} amount found" + ("; remove commas in JSON-LD" if "," in raw else "")
if price in numbers(NUM, text):
return "REVIEW", f"number found, but not as a {code or 'currency'} amount"
return "MISSING", f"no such {code or 'currency'} amount in visible text"
def check_text(key, value, text):
value = json_text(value)
if not value:
return "REVIEW", "empty value"
if contains(value, text):
return "OK", "found"
if key == "description":
return "REVIEW", "exact wording not found, a paraphrase may be fine"
words = value.split()
same = next((n for n in range(len(words) - 1, 0, -1)
if contains(" ".join(words[:n]), text)), 0)
return "MISSING", f'differs from "{" ".join(words[same:same + 5])}"'
def walk(node, text, report):
if isinstance(node, list):
for child in node:
walk(child, text, report)
if not isinstance(node, dict) or "@value" in node:
return
types = node.get("@type")
types = [re.split(r"[/#:]", t)[-1] for t in (types if isinstance(types, list) else [types])
if isinstance(t, str)]
fields = set().union(*(COMPARED.get(t, set()) for t in types))
label = next((t for t in types if t in COMPARED), types[0] if types else "node")
for key, raw in node.items():
if key in ("@context", "@type"):
continue
if key in NOT_TEXT:
report("SKIP", label, key, raw, NOT_TEXT[key])
continue
for value in raw if isinstance(raw, list) else [raw]:
if isinstance(value, dict) and "@value" in value:
value = value["@value"]
if key in fields and (value is None or isinstance(value, (dict, list))):
report("REVIEW", label, key, value, "not a simple value")
elif key in fields:
check = (check_price(node, value, text) if key in PRICE_KEYS
else check_text(key, value, text))
report(check[0], label, key, value, check[1])
elif not isinstance(value, (dict, list)):
report("SKIP", label, key, value, "not covered by this script")
walk(raw, text, report)
def bad_constant(name):
raise ValueError(f"{name} is not valid JSON")
def check(markup):
rows, page = [], Page(markup)
text = norm("".join(page.text))
def report(*row):
if row not in rows:
rows.append(row)
if len(text) < 200:
report("REVIEW", "page", "text", f"{len(text)} characters", "short, rendered by JavaScript?")
if not page.blocks:
report("REVIEW", "page", "JSON-LD", "none", "no JSON-LD block in this HTML")
for number, block in enumerate(page.blocks, 1):
try:
data = json.loads(block, parse_float=Decimal, parse_constant=bad_constant)
except ValueError as err:
report("ERROR", f"block {number}", "JSON", "unreadable", str(err))
continue
walk(data, text, report)
return rows
def load(source):
if not source.startswith(("http://", "https://")):
with open(source, encoding="utf-8-sig") as fh:
return fh.read()
req = urllib.request.Request(source, headers={"User-Agent": "own-site-jsonld-check/1.0"})
with urllib.request.urlopen(req, timeout=20) as res:
return res.read().decode(res.headers.get_content_charset() or "utf-8", "replace")
def main(sources):
failed = False
for source in sources:
print(f"== {source}")
try:
rows = check(load(source))
except (OSError, ValueError, LookupError, http.client.HTTPException) as err:
rows = [("ERROR", "page", "load", "failed", str(err))]
for status, label, key, value, why in rows:
shown = norm(str(value))
shown = shown if len(shown) <= 36 else shown[:33] + "..."
print(f"{status:<7} {label}.{key} = {shown} ({why})")
failed |= status in ("MISSING", "ERROR")
return int(failed)
if __name__ == "__main__":
sys.stdout.reconfigure(encoding="utf-8")
if len(sys.argv) < 2:
sys.exit("usage: python check_jsonld.py <file-or-url> [...]")
sys.exit(main(sys.argv[1:]))
The parser collects JSON-LD and page text separately. It adds spaces around block elements but not inline ones. That's why 3,<b>000</b>,000 becomes 3,000,000, while text from two paragraphs doesn't run together.
Numbers are compared as Decimal values, so 3000000 matches 3,000,000. It can also read 300만 원, a common Korean way to write the same amount. A number without the right currency is REVIEW, because "49 reviews" doesn't confirm a $49 price. Schema.org says not to use commas as separators in price. If the amount matches anyway, the output reminds you to remove them.
What does it find on the sample page?
This is the full output from the code and HTML above:
$ python check_jsonld.py sample.html
== sample.html
SKIP Organization.@id = https://example.com/#org (node identifier)
OK Organization.name = Example Studio (found)
SKIP Organization.url = https://example.com/ (link target)
SKIP Organization.logo = https://example.com/logo.png (image file)
OK Service.name = Care plan (found)
SKIP node.@id = https://example.com/#org (node identifier)
OK Offer.price = 3000000 (KRW amount found)
SKIP Offer.priceCurrency = KRW (currency code, used in the price check)
MISSING Offer.price = 39.00 (no such USD amount in visible text)
SKIP Offer.priceCurrency = USD (currency code, used in the price check)
OK Question.name = Can I get a refund? (found)
MISSING Answer.text = <p>Yes. Ask within 30 days of pay... (differs from "30 days of payment.")
ERROR block 3.JSON = unreadable (Illegal trailing comma before end of object: line 1 column 40 (char 39))
The exit code is 1, so a CI job can stop on MISSING or ERROR. REVIEW and SKIP don't fail the run.
Both real mismatches show up. The JSON-LD says $39, but the current price on the page is $49. The FAQ answer says 30 days, but the page says 14. The output shows where the answer starts to differ. The script can't tell which value is right, so check with whoever owns the price or policy. The third block is invalid because of its trailing comma, but the other two are still checked.
Which edge cases does it handle?
The script in this article was run on Windows with Python 3.14.3, using synthetic files and a server on 127.0.0.1. It wasn't tested on older Python versions or on a live site. The tests covered:
- nested data, reference-only
@idnodes, multiple types, full schema.org type URLs and@valueobjects - extra whitespace, non-breaking spaces, curly quotes, HTML in FAQ answers, and Korean names followed by particles
-
3000000,"3000000.00","3,000,000",₩3,000,000,300만 원, zero prices and text such as "Contact us" - empty blocks, trailing commas,
NaN, pages with no JSON-LD, missing files and HTTP errors - hidden text, crossed-out text and paragraphs with no closing tag
It still has limits:
- JavaScript: It doesn't run any. If your page adds text or JSON-LD in the browser, save the rendered page as HTML and check that file. A page with little text gets a warning, but a long page with one missing section might not.
-
CSS: It recognizes the
hiddenattribute and inlinedisplay:noneorvisibility:hidden. It doesn't read stylesheets or check what's covered or off screen. Closed<details>text counts because a visitor can open it. - Context: It searches the whole page. A price for product B can match product A's offer, and an answer can match text under a different question.
-
Numbers: It recognizes common marks for KRW, USD, EUR and GBP. Other currencies need their ISO code. It can't read decimal commas, such as
49,90 €, or combined Korean units, such as1억 2,000만 원. A plain$counts as US dollars unless a capital letter comes right before it. - HTML: Badly broken markup may be read differently than in a browser. It checks JSON-LD, but not Microdata or RDFa.
FAQ
Does MISSING mean the page breaks Google's policy?
No. The script didn't find that value in the text it can read. Compare the page, the JSON-LD and Google's rules for that type before you decide.
Why isn't a missing logo or URL flagged?
A logo is an image and a URL is a link, so their addresses don't need to appear as text. Check separately that each address works and points to the right thing.
Can I run it on someone else's site?
It's meant for pages you run. It only requests the URLs you enter, but it doesn't read robots.txt. For anything beyond a few pages, use your own HTML files or add crawl controls first.
Can I use this instead of a schema validator?
No, use both. A validator checks the syntax and properties, and this script compares a few values with the page text.
Published 2026-12-01. The linked Google and schema.org pages were checked the same day.


Top comments (0)