Scan, validate, and repair corrupted JSON-LD structured data blocks in HTML files. Prevent Google from silently dropping your rich snippets.
We discovered a critical SEO bug: Particle.js animation code was silently injected into a <script type="application/ld+json"> block, causing the entire Product schema to become invalid JSON. Google stopped indexing the rich snippet. No error was thrown in the browser.
This is the tool we built to catch and kill this bug automatically.
# Scan for corrupted schemas
python json_ld_guardian.py index.html
# Auto-remove corrupted blocks
python json_ld_guardian.py index.html --repair
# Generate a valid Product schema template
python json_ld_guardian.py --generate-product- Finds all
<script type="application/ld+json">blocks in any HTML file. - Validates each block as strict JSON. Reports exact parse error location.
- Detects JavaScript injection patterns (
function(,var,document., etc.) that corrupt the schema. - Auto-removes corrupted blocks and logs a clear explanation.
- Generates valid schema templates for
Product,WebSite,Organization.
Production landing page: Particle.js ran at page load, and a timing bug caused it to append function(){} into the JSON-LD block. The page looked perfect visually. But Google Search Console showed "Invalid JSON-LD" for 3 months before we caught it with this scanner.
"If Google can't read your schema, your rich snippets don't exist."
If this script saved your Google indexing or prevented an SEO disaster, consider buying me a coffee. It fuels the continuous development of these B2B engineering tools!