To validate JSON-LD in CI, run a script after the build that reads every HTML file, parses each JSON-LD block, checks it against a JSON Schema and exits with code 1 on any error. This post gives a Node script that does this with Ajv, tested locally, and says exactly what it does not check.
Usman Ishaq is a semantic SEO strategist and consultant, and the founder of Digital Vikingz. Markup is written from the visible page outward, and a template change can silently break it. A check in the pipeline catches that before it ships.
What does the check cover?
The script covers three things and ignores the rest.
Covered: each built page has at least one JSON-LD block, each block is valid JSON, and each business or Service node matches a JSON Schema that this project defines.
Not covered: schema.org vocabulary in general, eligibility for Google rich results, and whether the markup matches the visible text.
The schemas
Install the packages with npm install ajv ajv-formats , set "type": "module" in package.json…